This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix breakpoint commands buglet


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);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]