From: Don Howard <dhoward@redhat.com>
To: <gdb@sources.redhat.com>
Subject: [RFA] deleting breakpoints inside of 'commands'
Date: Tue, 11 Sep 2001 15:38:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.33.0109111057120.1364-100000@theotherone> (raw)
The following patch addresses a core-dump that occurs when a 'commands'
script deletes the current breakpoint:
(gdb) commands
>clear
>step
>end
(gdb) break foo
(gdb) continue
.
.
.
warning: Invalid control type in command structure.
Segmentation fault (core dumped)
What happens is the breakpoint (and the associated 'commands' script) is
deleted when first statement of the script is executed. GDB runs into a
core dump when it attempts to execute the remaining (deleted)
statements.
The patch below detects if the current breakpoint has been deleted and
terminates execution of the associated 'commands' script and issues a
warning.
Index: breakpoint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/breakpoint.c,v
retrieving revision 1.315
diff -p -u -r1.315 breakpoint.c
--- breakpoint.c 2001/07/13 23:55:47 1.315
+++ breakpoint.c 2001/09/11 22:29:40
@@ -1826,12 +1826,41 @@ top:
cmd = bs->commands;
while (cmd != NULL)
{
+ int number = bs->breakpoint_at->number;
+
execute_control_command (cmd);
if (breakpoint_proceeded)
break;
else
- cmd = cmd->next;
+ {
+ /* 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!).
+
+ If this happens we stop processing of this command
+ chain and issue a warning.
+ */
+
+ struct command_line *next_cmd = cmd->next;
+ struct breakpoint *b;
+ ALL_BREAKPOINTS (b)
+ {
+ if (bs->breakpoint_at == b)
+ {
+ cmd = next_cmd;
+ break;
+ }
+ else
+ {
+ cmd = NULL;
+ }
+ }
+ if (cmd == NULL)
+ warning ("Breakpoint %d deleted while executing commands.",
+ number);
+ }
}
if (breakpoint_proceeded)
/* The inferior is proceeded by the command; bomb out now.
--
-Don
dhoward@redhat.com
gdb engineering
next reply other threads:[~2001-09-11 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-11 15:38 Don Howard [this message]
2001-09-12 1:47 ` Pierre Muller
2001-09-13 1:01 ` Pierre Muller
2001-09-13 13:50 ` Don Howard
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.0109111057120.1364-100000@theotherone \
--to=dhoward@redhat.com \
--cc=gdb@sources.redhat.com \
/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