From: Don Howard <dhoward@redhat.com>
To: Pierre Muller <muller@cerbere.u-strasbg.fr>
Cc: <gdb@sources.redhat.com>
Subject: Re: [RFA] deleting breakpoints inside of 'commands'
Date: Thu, 13 Sep 2001 13:50:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.33.0109131315390.1364-100000@theotherone> (raw)
In-Reply-To: <4.2.0.58.20010913094436.00c609e0@ics.u-strasbg.fr>
I've attempted to implement your sugesstion in the patch below. I need
some feedback from folks who are familiar with the breakpoint code. I
think it maybe as you say, that a copy of the commands list should be
allocated. With this patch, gdb no longer dumps core when a command
list deletes it's breakpoint, but commands lists get lost after hitting
the associated breakpoint once or twice.
If someone can explain to me what gdb does with bpstat structures when
the target continues, (and how that may interact with this patch) that
would be most useful.
2001-09-12 Don Howard <dhoward@redhat.com>
* breakpoint.c (bpstat_do_actions): Avoid deleting a 'commands'
list while executing that list. Thanks to Pierre Muller
<muller@ics.u-strasbg.fr> for suggesting this implementation.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.52
diff -p -u -w -r1.52 breakpoint.c
--- breakpoint.c 2001/08/02 11:58:28 1.52
+++ breakpoint.c 2001/09/13 20:16:18
@@ -1824,7 +1824,24 @@ top:
breakpoint_proceeded = 0;
for (; bs != NULL; bs = bs->next)
{
- cmd = bs->commands;
+ /* It is possible that the list of commands we are executing
+ includes a command to delete the current breakpoint, which
+ will also delete the current command list (oops!).
+
+ Pierre Muller <muller at cerbere dot u-strasbg dot fr>
+ suggested that the commands list could be disconnected from
+ it's associated breakpoint structure during execution of the
+ list. Once execution is complete, we check for the
+ non-existence of the breakpoint. If the breakpoint has been
+ deleted, we free the associated command list. */
+
+ struct command_line *head_cmd;
+
+ head_cmd = cmd = bs->commands;
+ bs->commands = NULL;
+ if (bs->breakpoint_at)
+ bs->breakpoint_at->commands = NULL;
+
while (cmd != NULL)
{
execute_control_command (cmd);
@@ -1834,6 +1851,31 @@ top:
else
cmd = cmd->next;
}
+
+ /* Detect if the command list has deleted the current
+ breakpoint. */
+ {
+ int deleted = 1;
+ struct breakpoint *b;
+
+ ALL_BREAKPOINTS (b)
+ if (bs->breakpoint_at == b)
+ {
+ deleted = 0;
+ break;
+ }
+
+ if (deleted)
+ free_command_lines (&head_cmd);
+ else
+ {
+ bs->commands = head_cmd;
+ if (bs->breakpoint_at)
+ bs->breakpoint_at->commands = head_cmd;
+ }
+ }
+
+
if (breakpoint_proceeded)
/* The inferior is proceeded by the command; bomb out now.
The bpstat chain has been blown away by wait_for_inferior.
--
-Don
dhoward@redhat.com
gdb engineering
next prev parent reply other threads:[~2001-09-13 13:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-11 15:38 Don Howard
2001-09-12 1:47 ` Pierre Muller
2001-09-13 1:01 ` Pierre Muller
2001-09-13 13:50 ` Don Howard [this message]
2001-09-13 14:14 ` Andrew Cagney
2001-09-14 18:09 ` Don Howard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.33.0109131315390.1364-100000@theotherone \
--to=dhoward@redhat.com \
--cc=gdb@sources.redhat.com \
--cc=muller@cerbere.u-strasbg.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox