mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 01:28:46 +00:00
sim/rx: fix an issue where we try to modify a const string
While experimenting with switching on warnings for the rx simulator I discovered this bug. In sim_do_command we get passed a 'const char *' argument. We create a copy of this string to work with locally, but then while processing this we accidentally switch back to reference the original string. sim/rx/ChangeLog: * gdb-if.c (sim_do_command): Work with a copy of the command.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* gdb-if.c (sim_do_command): Work with a copy of the command.
|
||||
|
||||
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* gdb-if.c (sim_memory_map): New function.
|
||||
|
||||
@@ -804,13 +804,13 @@ sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
p++;
|
||||
|
||||
/* Find the extent of the command word. */
|
||||
for (p = cmd; *p; p++)
|
||||
for (; *p != '\0'; p++)
|
||||
if (isspace (*p))
|
||||
break;
|
||||
|
||||
/* Null-terminate the command word, and record the start of any
|
||||
further arguments. */
|
||||
if (*p)
|
||||
if (*p != '\0')
|
||||
{
|
||||
*p = '\0';
|
||||
args = p + 1;
|
||||
|
||||
Reference in New Issue
Block a user