This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 2/2] Do not bpstat_clear_actions on throw_exception #3
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Mon, 22 Aug 2011 18:06:15 +0100
- Subject: Re: [patch 2/2] Do not bpstat_clear_actions on throw_exception #3
- References: <20110822145150.GB11817@host1.jankratochvil.net>
On Monday 22 August 2011 15:51:50, Jan Kratochvil wrote:
> On Thu, 18 Aug 2011 18:42:19 +0200, Pedro Alves wrote:
> > Unfortunately, the hook-stop handling is in normal_stop.
> > Your patch clears the breakpoint commands before get get a chance
> > to run if the user installs a hook-stop. E.g., before:
>
> OK, I agree, I have made a new testcase.
Thanks.
> > This looks tricky to get right without changing gdb's behavior :-(
>
> The question is how big changed you were thinking about.
>
> One problem I find one cannot use "step" and other such commands in the
> breakpoints commands lists. This may be due to GDB trying not to overflow its
> stack. I gues with async mode it could be implementable as some
> stack-in-data-structure.
Yes, I going in that direction with
<http://sourceware.org/ml/gdb-patches/2011-06/msg00158.html>,
but there are other places I hadn't made fully state-machined
on that patch. Unfortunately, I can't afford finishing
that one now, and I flipped to a plan B.
> But that seems to be out of scope of this patch.
For sure.
> > We could try pushing bpstat_do_actions to the end of an execution
> > command's run, but e.g., that would change the behavior of
> > breakpoint commands in command lists, and things like "step N".
> > OTOH, maybe that'd be the right thing to do (the current
> > behavior could be seen as buggy --- more thought is needed).
>
> I was playing with various changes but it had various side-effects.
>
> Do you have anything against this patch?
No, looks almost good enough. I like that it's simple.
> I hope I have caught all the cases
> where exceptions can be thrown. Otherwise IMO everything is caught by
> execute_command anyway.
Not all cases. In async mode, handle_inferior_event is called
_outside_ of execute_command, directly by the event loop (well, almost
directly). Thus any exception thrown between bpstat_stop_status is called,
and the bpstat_do_actions call in inf-loop.c, will leave the thread
with a dangling bpstat too. Might be good enough to wrap
handle_inferior_event with a similar cleanup?
--
Pedro Alves