This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix cleanup in finish_command
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org, Markus Metzger <markus dot t dot metzger at intel dot com>
- Date: Thu, 20 Jun 2013 16:37:16 +0100
- Subject: Re: [patch] Fix cleanup in finish_command
- References: <20130619211444 dot GA29379 at host2 dot jankratochvil dot net> <20130620143118 dot GA11929 at host2 dot jankratochvil dot net> <20130620151806 dot GD4724 at adacore dot com>
On 06/20/2013 04:18 PM, Joel Brobecker wrote:
>> BTW I have found the crash happens even with this patch, I haven't found the
>> real cause yet.
>
> Interesting, as I couldn't understand the relationship between
> the backtrace and the patch... You might also be in a situation
> similar to what I faced on Darwin: a correct cleanup fix triggering
> a latent bug; In that situation I found it useful to first git-bisect
> to narrow down the commit that caused the change of behavior, and
> then finish the bug off with valgrind's help.
Seems to be that GDB got a SIGHUP while within proceed. That
causes a "quit", which kills the inferior, and cancels it's
threads' continuations, which deletes the finish breakpoint.
>From the patch, I take it the cleanup that is supposed to delete
that same finish breakpoint on error somehow ran before that,
so that the end result is that GDB ended up trashed for
trying to delete the same breakpoint twice?
The discard_cleanups is after proceed because proceed may
error too, with e.g., a QUIT, though other regular errors
may happen. I think fixing this needs a bit more work.
On error, the continuations are left stale in the thread
(try hacking an error call just before proceed, after installing
the continuation), which is wrong as it'll cause problems
for the next execution command... I think we need to move
the discard_cleanups above proceed, but, also make sure the
continuations are cancelled on error (IOW, cancel the
whole command on error). Maybe install a new cleanup
while `proceed' is running, that runs:
do_all_intermediate_continuations (1);
do_all_continuations (1);
(See inferior_event_handler.)
--
Pedro Alves