2010-03-26 Tom Tromey <tromey@redhat.com>
authorStan Shebs <shebs@codesourcery.com>
Fri, 26 Mar 2010 23:49:31 +0000 (23:49 +0000)
committerStan Shebs <shebs@codesourcery.com>
Fri, 26 Mar 2010 23:49:31 +0000 (23:49 +0000)
* breakpoint.c (commands_command_1): Duplicate 'arg'.

gdb/ChangeLog
gdb/breakpoint.c

index b9d6b48c2878222aa95950b11b43ef8dae84a49b..d539e8f9e2afd2a63b7060babe20d31af6c6c4d1 100644 (file)
@@ -1,3 +1,7 @@
+2010-03-26  Tom Tromey  <tromey@redhat.com>
+
+       * breakpoint.c (commands_command_1): Duplicate 'arg'.
+
 2010-03-26  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * breakpoint.c (expand_line_sal_maybe): Always call skip_prologue_sal.
index a6bde43f37f6e7bb09fdce80e834a7998f4bd337..e9fb71ebc8fc696d642f7e666f266fde15ae80fd 100644 (file)
@@ -959,8 +959,12 @@ commands_command_1 (char *arg, int from_tty, struct command_line *control)
        arg = xstrprintf ("%d-%d", multi_start, multi_end);
       else if (breakpoint_count > 0)
        arg = xstrprintf ("%d", breakpoint_count);
-      make_cleanup (xfree, arg);
     }
+  else
+    /* The command loop has some static state, so we need to preserve
+       our argument.  */
+    arg = xstrdup (arg);
+  make_cleanup (xfree, arg);
 
   map_breakpoint_numbers (arg, do_map_commands_command, &info);