aboutsummaryrefslogtreecommitdiff
path: root/sim/rl78
diff options
context:
space:
mode:
Diffstat (limited to 'sim/rl78')
-rw-r--r--sim/rl78/ChangeLog5
-rw-r--r--sim/rl78/gdb-if.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/sim/rl78/ChangeLog b/sim/rl78/ChangeLog
index 4b556cc..654d1d6 100644
--- a/sim/rl78/ChangeLog
+++ b/sim/rl78/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-10 Mike Frysinger <vapier@gentoo.org>
+
+ * gdb-if.c (sim_do_command): Add const to cmd. Move args
+ to top and add const. Call strdup on cmd and free at end.
+
2014-03-05 Mike Frysinger <vapier@gentoo.org>
* gdb-if.c (sim_load): Add const to prog.
diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c
index 6c4b5b5..f8712bf 100644
--- a/sim/rl78/gdb-if.c
+++ b/sim/rl78/gdb-if.c
@@ -499,9 +499,10 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
command. */
void
-sim_do_command (SIM_DESC sd, char *cmd)
+sim_do_command (SIM_DESC sd, const char *cmd)
{
- char *args;
+ const char *args;
+ char *p = strdup (cmd);
check_desc (sd);
@@ -512,8 +513,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
}
else
{
- char *p = cmd;
-
/* Skip leading whitespace. */
while (isspace (*p))
p++;
@@ -561,6 +560,8 @@ sim_do_command (SIM_DESC sd, char *cmd)
else
printf ("The 'sim' command expects either 'trace' or 'verbose'"
" as a subcommand.\n");
+
+ free (p);
}
/* Stub for command completion. */