This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: remote, defer deleting the inferior until it is mourned
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Dec 2008 13:51:54 +0000
- Subject: Re: remote, defer deleting the inferior until it is mourned
- References: <200812120111.13658.pedro@codesourcery.com>
On Friday 12 December 2008 01:11:13, Pedro Alves wrote:
> To fix this, we either set inferior_ptid to null_ptid before deleting the
> inferior when we want to prevent this, or, we defer deleting the inferior to
> generic_mourn_inferior, which does just that. I've done the latter.
Next in queue, make the extended-remote version of mourning always
call generic_mourn_inferior, to always get rid of the current inferior,
even if there are more inferiors to debug. This only became possible
since the change to make handle_inferior_event switch inferior_ptid to the
event ptid on a process exit (we were also discarding leftover
unprocessed events from the wrong inferior before that change, just a
bit above the generic_mourn_inferior call I'm moving).
Tested against an x86_64-linux-gnu gdbserver. Checked in.
The next issue is that extended_remote_mourn is handling the switching
to another process itself, which was an idea borrowed from the linux
multi-fork support. This is problematic for a few reasons, and would be
best done in common code. More on that soon.
--
Pedro Alves
2008-12-12 Pedro Alves <pedro@codesourcery.com>
* remote.c (extended_remote_mourn_1): Always call
generic_mourn_inferior.
---
gdb/remote.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c 2008-12-12 13:03:23.000000000 +0000
+++ src/gdb/remote.c 2008-12-12 13:03:52.000000000 +0000
@@ -6551,6 +6551,9 @@ extended_remote_mourn_1 (struct target_o
/* Unlike "target remote", we do not want to unpush the target; then
the next time the user says "run", we won't be connected. */
+ /* Call common code to mark the inferior as not running. */
+ generic_mourn_inferior ();
+
if (have_inferiors ())
{
extern void nullify_last_target_wait_ptid ();
@@ -6562,10 +6565,6 @@ extended_remote_mourn_1 (struct target_o
}
else
{
- struct remote_state *rs = get_remote_state ();
-
- /* Call common code to mark the inferior as not running. */
- generic_mourn_inferior ();
if (!remote_multi_process_p (rs))
{
/* Check whether the target is running now - some remote stubs