aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-03 01:44:44 -0500
committerMike Frysinger <vapier@gentoo.org>2016-01-03 03:50:08 -0500
commitaba6f46b235a3a139c04d5ed6a3310125aa9c982 (patch)
tree40560a52364dbfb8bc808fcada9fe80a20d92270 /sim/common
parent0cb8d8513cf44a102953ff5cf93e9dd399f42e9a (diff)
downloadgdb-aba6f46b235a3a139c04d5ed6a3310125aa9c982.zip
gdb-aba6f46b235a3a139c04d5ed6a3310125aa9c982.tar.gz
gdb-aba6f46b235a3a139c04d5ed6a3310125aa9c982.tar.bz2
sim: nrun: use lbasename
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/nrun.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index d931834..2e444d1 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2016-01-03 Mike Frysinger <vapier@gentoo.org>
+ * nrun.c (myname): Mark const.
+ (main): Mark name const. Replace myname parsing loop with a
+ call to lbasename.
+
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
(CONFIG_CFLAGS): Delte $(SIM_HOSTENDIAN).
* acinclude.m4 (SIM_AC_COMMON): Call AC_C_BIGENDIAN.
(SIM_AC_OPTION_HOSTENDIAN): Delete.
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2e47715..94ba35d 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -47,7 +47,7 @@ static void usage (void);
extern host_callback default_callback;
-static char *myname;
+static const char *myname;
static SIM_DESC sd;
@@ -64,7 +64,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;
@@ -72,9 +72,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