aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2002-08-27 01:09:09 +0000
committerMichael Snyder <msnyder@vmware.com>2002-08-27 01:09:09 +0000
commitc2b8ed2c806135f28c880b614ab8728a8c2afa65 (patch)
treeecbb723f71dc746575e21e3856bb90b1b1823770 /gdb/breakpoint.c
parentb1f3a3732a9b31d1ac44847847e71506cefc800e (diff)
downloadgdb-c2b8ed2c806135f28c880b614ab8728a8c2afa65.zip
gdb-c2b8ed2c806135f28c880b614ab8728a8c2afa65.tar.gz
gdb-c2b8ed2c806135f28c880b614ab8728a8c2afa65.tar.bz2
2002-08-26 Joel Brobecker <brobecker@gnat.com>
* cli/cli-script.c (copy_command_lines): New function. * defs.h (copy_command_lines): Export. * testsuite/gdb.base/commands.exp: New tests for commands attached to a temporary breakpoint, and for commands that delete the breakpoint they are attached to. 2002-08-26 Michael Snyder <msnyder@redhat.com> * breakpoint.c (bpstat_stop_status): Instead of copying the pointer to the breakpoint commands struct, make a new copy of the struct and point to that. (bpstat_clear): Free the commands struct. (bpstat_clear_actions): Free the commands struct. (bpstat_do_actions): Free the command actions. Also execute the local cleanups, instead of deleting them. (delete_breakpoint): Leave the commands field of the bpstat chain alone -- it will be freed later.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0f498af..630536f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1763,6 +1763,7 @@ bpstat_clear (bpstat *bsp)
q = p->next;
if (p->old_val != NULL)
value_free (p->old_val);
+ free_command_lines (&p->commands);
xfree (p);
p = q;
}
@@ -1875,7 +1876,7 @@ bpstat_clear_actions (bpstat bs)
{
for (; bs != NULL; bs = bs->next)
{
- bs->commands = NULL;
+ free_command_lines (&bs->commands);
if (bs->old_val != NULL)
{
value_free (bs->old_val);
@@ -1944,11 +1945,9 @@ top:
to look at, so start over. */
goto top;
else
- bs->commands = NULL;
+ free_command_lines (&bs->commands);
}
-
- executing_breakpoint_commands = 0;
- discard_cleanups (old_chain);
+ do_cleanups (old_chain);
}
/* This is the normal print function for a bpstat. In the future,
@@ -2730,7 +2729,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
/* We will stop here */
if (b->disposition == disp_disable)
b->enable_state = bp_disabled;
- bs->commands = b->commands;
+ bs->commands = copy_command_lines (b->commands);
if (b->silent)
bs->print = 0;
if (bs->commands &&
@@ -6787,14 +6786,8 @@ delete_breakpoint (struct breakpoint *bpt)
if (bs->breakpoint_at == bpt)
{
bs->breakpoint_at = NULL;
-
- /* we'd call bpstat_clear_actions, but that free's stuff and due
- to the multiple pointers pointing to one item with no
- reference counts found anywhere through out the bpstat's (how
- do you spell fragile?), we don't want to free things twice --
- better a memory leak than a corrupt malloc pool! */
- bs->commands = NULL;
bs->old_val = NULL;
+ /* bs->commands will be freed later. */
}
/* On the chance that someone will soon try again to delete this same
bp, we mark it as deleted before freeing its storage. */