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]

breakpoint.c minor cleanups


This patch does minor cleanups in breakpoint.c.
Approved off-list by Jim Blandy and checked in.

- Volodya

--- gdb/breakpoint.c	(/work/multiple_breakpoints_pieces/2_no_silent)	(revision 4489)
+++ gdb/breakpoint.c	(/work/multiple_breakpoints_pieces/3_bpstat_clear)	(revision 4489)
@@ -1906,6 +1906,15 @@ ep_is_exception_catchpoint (struct break
     || (ep->type == bp_catch_throw);
 }
 
+void 
+bpstat_free (bpstat bs)
+{
+  if (bs->old_val != NULL)
+    value_free (bs->old_val);
+  free_command_lines (&bs->commands);
+  xfree (bs);
+}
+
 /* Clear a bpstat so that it says we are not at any breakpoint.
    Also free any storage that is part of a bpstat.  */
 
@@ -1921,10 +1930,7 @@ bpstat_clear (bpstat *bsp)
   while (p != NULL)
     {
       q = p->next;
-      if (p->old_val != NULL)
-	value_free (p->old_val);
-      free_command_lines (&p->commands);
-      xfree (p);
+      bpstat_free (p);
       p = q;
     }
   *bsp = NULL;
@@ -7069,7 +7075,13 @@ delete_breakpoint (struct breakpoint *bp
 
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
   /* FIXME, how can we find all bpstat's?
-     We just check stop_bpstat for now.  */
+     We just check stop_bpstat for now.  Note that we cannot just
+     remove bpstats pointing at bpt from the stop_bpstat list
+     entirely, as breakpoint commands are associated with the bpstat;
+     if we remove it here, then the later call to
+         bpstat_do_actions (&stop_bpstat);
+     in event-top.c won't do anything, and temporary breakpoints
+     with commands won't work.  */
   for (bs = stop_bpstat; bs; bs = bs->next)
     if (bs->breakpoint_at == bpt)
       {
--- gdb/breakpoint.h	(/work/multiple_breakpoints_pieces/2_no_silent)	(revision 4489)
+++ gdb/breakpoint.h	(/work/multiple_breakpoints_pieces/3_bpstat_clear)	(revision 4489)
@@ -430,9 +430,12 @@ struct breakpoint
 
 typedef struct bpstats *bpstat;
 
-/* Interface:  */
-/* Clear a bpstat so that it says we are not at any breakpoint.
-   Also free any storage that is part of a bpstat.  */
+/* Frees any storage that is part of a bpstat.
+   Does not walk the 'next' chain.  */
+extern void bpstat_free (bpstat);
+
+/* Clears a chain of bpstat, freeing storage
+   of each.  */
 extern void bpstat_clear (bpstat *);
 
 /* Return a copy of a bpstat.  Like "bs1 = bs2" but all storage that

Property changes on: 
___________________________________________________________________
Name: svk:merge
  d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/coldfire/gdb:4053
  d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/coldfire_registers/gdb:2971
  d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/multiple_breakpoints_pieces/1_dont_zero_address:4453
 +d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/multiple_breakpoints_pieces/2_no_silent:4457
  d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/register_browsing/gdb:2430
  d48a11ec-ee1c-0410-b3f5-c20844f99675:/work/register_browsing/gdb_rb:2477
  e7755896-6108-0410-9592-8049d3e74e28:/csl/gdb/branches/drow-inline:173134


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