From: Daniel Jacobowitz <drow@false.org>
To: Carl Shapiro <carl.shapiro@gmail.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb@sourceware.org
Subject: Re: Problems with hook-stop
Date: Sat, 29 Sep 2007 21:44:00 -0000 [thread overview]
Message-ID: <20070929210750.GA10190@caradoc.them.org> (raw)
In-Reply-To: <4dcb5abd0709271725v73cdf443q46fb43c985474c21@mail.gmail.com>
On Thu, Sep 27, 2007 at 05:25:33PM -0700, Carl Shapiro wrote:
> On 9/27/07, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > Since SIGTRAP has a very special meaning for debugging, it's probably
> > unwise to play games like this.
>
> The problem I am having is not specific to SIGTRAP. You can replace
> the interrupt instruction with a kill(2), providing any signal you'd
> like as an argument. The stop hook will fails execute every other
> time.
Thank you for the test case. This was very useful.
The problem is that we are still running the stop hook for the
first stop when the program stops the second time. Basically,
the stop "command" has been run again from inside the first
hook-stop. There's a safety check for recursive hooks to prevent
GDB blowing out its stack. If that weren't there you'd have an
even more unpleasant bug to report.
To fix this we would need to make a decision about what happens when
a hook (or a breakpoint commands list, it's basically the same thing)
runs the target. We don't want to necessarily abort the hook.
Consider:
define hook-stop
call dump_state ()
echo done
end
Assuming there's no breakpoint or crash in dump_state, then we should
run the function to completion and continue executing the stop hook.
Maybe we should handle hooks and commands lists specially when they
end in continue or signal. Basically a tail recursion optimization.
I'm not going to try to do that right now, but I hope this explanation
is helpful :-)
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-09-29 21:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 16:06 Carl Shapiro
2007-09-27 12:06 ` Mark Kettenis
2007-09-28 1:23 ` Carl Shapiro
2007-09-29 21:44 ` Daniel Jacobowitz [this message]
2007-10-02 7:57 ` Carl Shapiro
2007-10-02 11:42 ` Daniel Jacobowitz
2007-09-27 12:35 ` Christian Thalinger
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=20070929210750.GA10190@caradoc.them.org \
--to=drow@false.org \
--cc=carl.shapiro@gmail.com \
--cc=gdb@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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