sim: constify arg to sim_do_command
[deliverable/binutils-gdb.git] / sim / m32c / gdb-if.c
index bec9d48838ac0c151f6d234ba31b14995df99a61..a617b7cb1c2ef245f43ed2192e32a1ab56ee8c43 100644 (file)
@@ -650,11 +650,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))
@@ -667,7 +668,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';
@@ -701,6 +701,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 **
This page took 0.026865 seconds and 4 git commands to generate.