X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fcommon%2Fnrun.c;h=cbf7b5e2e14762f88492f711a13ef66ce16d2ff1;hb=a435742a7fb32f6320ce0e6074e2500e28378104;hp=80f2c80220febd3101ef55afe4777d5c016e40a2;hpb=8acc9f485bba28b65935dcc3498d9f3b712ddac7;p=deliverable%2Fbinutils-gdb.git
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 80f2c80220..cbf7b5e2e1 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -1,5 +1,5 @@
/* New version of run front end support for simulators.
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,11 +16,11 @@ along with this program. If not, see . */
/* Need to be before general includes, to pick up e.g. _GNU_SOURCE. */
#ifdef HAVE_CONFIG_H
-#include "cconfig.h"
-#include "tconfig.h"
+#include "config.h"
#endif
#include
+#include
/* For strsignal. */
#ifdef HAVE_STRING_H
@@ -48,7 +48,7 @@ static void usage (void);
extern host_callback default_callback;
-static char *myname;
+static const char *myname;
static SIM_DESC sd;
@@ -65,7 +65,7 @@ cntrl_c (int sig)
int
main (int argc, char **argv)
{
- char *name;
+ const char *name;
char **prog_argv = NULL;
struct bfd *prog_bfd;
enum sim_stop reason;
@@ -73,9 +73,7 @@ main (int argc, char **argv)
int single_step = 0;
RETSIGTYPE (*prev_sigint) ();
- myname = argv[0] + strlen (argv[0]);
- while (myname > argv[0] && myname[-1] != '/')
- --myname;
+ myname = lbasename (argv[0]);
/* INTERNAL: When MYNAME is `step', single step the simulator
instead of allowing it to run free. The sole purpose of this
@@ -100,7 +98,7 @@ main (int argc, char **argv)
/* We can't set the endianness in the callback structure until
sim_config is called, which happens in sim_open. */
default_callback.target_endian
- = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN
+ = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
/* Was there a program to run? */