[PATCH] Fix breakpoint commands buglet

Stan Shebs stan@codesourcery.com
Fri Mar 26 23:54:00 GMT 2010


The new breakpoint commands code got a little freaky when the 
prompted-for commands were long, such as for tracepoint collection 
commands - Tom fixed, I tested, no regressions, now committed.

Stan

2010-03-26  Tom Tromey  <tromey@redhat.com>

    * breakpoint.c (commands_command_1): Duplicate 'arg'.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.470
diff -p -r1.470 breakpoint.c
*** breakpoint.c    26 Mar 2010 19:41:50 -0000    1.470
--- breakpoint.c    26 Mar 2010 23:48:09 -0000
*************** commands_command_1 (char *arg, int from_
*** 959,966 ****
      arg = xstrprintf ("%d-%d", multi_start, multi_end);
        else if (breakpoint_count > 0)
      arg = xstrprintf ("%d", breakpoint_count);
-       make_cleanup (xfree, arg);
      }
 
    map_breakpoint_numbers (arg, do_map_commands_command, &info);
 
--- 959,970 ----
      arg = xstrprintf ("%d-%d", multi_start, multi_end);
        else if (breakpoint_count > 0)
      arg = xstrprintf ("%d", breakpoint_count);
      }
+   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);
 



More information about the Gdb-patches mailing list