This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Code cleanup: Remove parameter quitting [Re: Crash of GDB with gdbserver btrace enabled]
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "markus dot t dot metzger at gmail dot com" <markus dot t dot metzger at gmail dot com>, "Himpel, Christian" <christian dot himpel at intel dot com>
- Date: Mon, 25 Mar 2013 20:12:19 +0100
- Subject: Re: [patch] Code cleanup: Remove parameter quitting [Re: Crash of GDB with gdbserver btrace enabled]
- References: <A78C989F6D9628469189715575E55B2307B9BC7C at IRSMSX102 dot ger dot corp dot intel dot com> <20130307101350 dot GA14969 at host2 dot jankratochvil dot net> <A78C989F6D9628469189715575E55B2307B9BCEE at IRSMSX102 dot ger dot corp dot intel dot com> <20130307120644 dot GA21253 at host2 dot jankratochvil dot net> <A78C989F6D9628469189715575E55B2307B9C01C at IRSMSX102 dot ger dot corp dot intel dot com> <5138AE4C dot 3060801 at redhat dot com> <20130318170643 dot GA15625 at host2 dot jankratochvil dot net> <514758DA dot 2060905 at redhat dot com> <20130318192604 dot GA2786 at host2 dot jankratochvil dot net> <51477828 dot 30000 at redhat dot com>
Hi Pedro,
I do not plan to do any changes mentioned below, it is just an affirmation
future development has an agreed upon design.
On Mon, 18 Mar 2013 21:25:12 +0100, Pedro Alves wrote:
> Other Debug APIs may
> require a "debug_api_foo_close ()" call that actually results in traffic,
> to properly release the reference to the debug api library. remote-mips.c
> seems to be doing something like that, and it's the sort of code that
> could hang/block for a while, so it seems to me like the original intent
> of QUITTING would be to handle _that_ kind of blocking. If "QUITTING",
> GDB is quitting, so don't bother being nice to your debug API library,
> if that takes long and hang a fast "quit" experience, as the whole GDB
> process is going away anyway. Otherwise, if not QUITTING, take care to
> clean up properly, because the user may want to spawn a new debug session,
> in the same GDB process.
Do you think that the mips_close packet communication should have been done
only if !QUITTING? This would mean the GDB "quit" command would leave the
MIPS target in some inconsistent state, possibly not ready for a new
connection later (assuming the MIPS target cannot accept new connection
without previous mips_exit_debug packets).
quit_command already does disconnect_tracing and then (target_detach or
target_kill) before target_close. I miss target_disconnect in quit_command.
This could do the packet communication part of mips_close. mips_close then
would not communicate anything so that mips_close is always safe in some
broken communication cases. And even the quit_command call of
disconnect_tracing could be then removed and disconnect_tracing called only
from remote_disconnect.
That target_detach or target_kill could be kept only for compatibility with
old targets (if there are any), normal targets should do
target_detach/target_kill automatically from to_disconnect.
> Yes, it certainly should _not_ send "D", as that's not RSP's "close
> connection packet", it has more meaning than that -- it makes gdbserver itself
> detach from the inferior, for example.
I see I have mistaken "D". So remote_close does not need to do any packet
communication thanks to the gdbserver protocol design.
> Releasing
> resources in the backend debug API side (the remote stub, in the RSP case)
> related to the inferior IMO (breakpoints, etc.) should not be done in
> to_close. If necessary, these resources should be released through some
> other mechanism or target hook. E.g., removing breakpoints in always inserted
> mode could be done even as late as in to_detach, but not in to_close.
OK, thanks for clarification of the design.
Jan