* breakpoint.c (bpstat_free): New.
authorVladimir Prus <vladimir@codesourcery.com>
Fri, 17 Aug 2007 17:06:04 +0000 (17:06 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Fri, 17 Aug 2007 17:06:04 +0000 (17:06 +0000)
(bpstat_clear): Use bpstat_free.
(delete_breakpoint): Document why we cannot
remove bpstats from stop_bpstat.
* breakpoint.h (bpstat_free): Declare.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h

index 43428c135177f8da9985965f4b35494105fa8e63..5e50fa6271d9b2f9237eebf7402b0d73068b5ca1 100644 (file)
@@ -1,3 +1,11 @@
+2007-08-17  Vladimir Prus  <vladimir@codesourcery.com>
+
+       * breakpoint.c (bpstat_free): New.
+       (bpstat_clear): Use bpstat_free.
+       (delete_breakpoint): Document why we cannot
+       remove bpstats from stop_bpstat.
+       * breakpoint.h (bpstat_free): Declare.
+               
 2007-08-16  Michael Snyder  <msnyder@access-company.com>
 
         * event-loop.c (gdb_wait_for_event): Move statement into "if" block.
index f798710dfb83e3c723d40c8bda0eac9ab8ef16ce..3875aacd5a5b381c05e2a3dc26133b3b6621b0ea 100644 (file)
@@ -1897,6 +1897,15 @@ ep_is_exception_catchpoint (struct breakpoint *ep)
     || (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.  */
 
@@ -1912,10 +1921,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;
@@ -7051,7 +7057,13 @@ delete_breakpoint (struct breakpoint *bpt)
 
   /* 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)
       {
index b7996a5b3725ce870e399f60c8f66f9728688ff6..701d85c3c3006ae7015af7e491308a756eae3341 100644 (file)
@@ -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
This page took 0.053908 seconds and 4 git commands to generate.