aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2007-08-17 17:06:04 +0000
committerVladimir Prus <vladimir@codesourcery.com>2007-08-17 17:06:04 +0000
commit198757a8b19977e7d4bb048dac03fb207ce228ac (patch)
treeb3c9c7e4ff4e7e3d002265eae9d3ae7945247e4d /gdb/breakpoint.c
parent3992d3b7e252d9e75fe1ea0264b2761fe3e85d24 (diff)
downloadgdb-198757a8b19977e7d4bb048dac03fb207ce228ac.zip
gdb-198757a8b19977e7d4bb048dac03fb207ce228ac.tar.gz
gdb-198757a8b19977e7d4bb048dac03fb207ce228ac.tar.bz2
* 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.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f798710..3875aac 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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)
{