]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/rx/gdb-if.c
sim: constify arg to sim_do_command
[thirdparty/binutils-gdb.git] / sim / rx / gdb-if.c
index 77048a0a0f9dfeb585074309be25a2680925f88d..3ccea98df3d3f02abcda60bf6df4ddba0800cfda 100644 (file)
@@ -791,11 +791,12 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
 }
 
 void
-sim_do_command (SIM_DESC sd, char *cmd)
+sim_do_command (SIM_DESC sd, const char *cmd)
 {
-  check_desc (sd);
+  const char *args;
+  char *p = strdup (cmd);
 
-  char *p = cmd;
+  check_desc (sd);
 
   /* Skip leading whitespace.  */
   while (isspace (*p))
@@ -808,7 +809,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
 
   /* Null-terminate the command word, and record the start of any
      further arguments.  */
-  char *args;
   if (*p)
     {
       *p = '\0';
@@ -844,6 +844,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);
 }
 
 char **