From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23398 invoked by alias); 12 Dec 2008 13:52:23 -0000 Received: (qmail 23386 invoked by uid 22791); 12 Dec 2008 13:52:22 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Dec 2008 13:51:45 +0000 Received: (qmail 14270 invoked from network); 12 Dec 2008 13:51:43 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 12 Dec 2008 13:51:43 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: remote, defer deleting the inferior until it is mourned Date: Fri, 12 Dec 2008 13:52:00 -0000 User-Agent: KMail/1.9.10 References: <200812120111.13658.pedro@codesourcery.com> In-Reply-To: <200812120111.13658.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_6xmQJ6w5fHzHdCL" Message-Id: <200812121351.54822.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00223.txt.bz2 --Boundary-00=_6xmQJ6w5fHzHdCL Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1093 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 --Boundary-00=_6xmQJ6w5fHzHdCL Content-Type: text/x-diff; charset="iso 8859-15"; name="remote_mourn_2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remote_mourn_2.diff" Content-length: 1163 2008-12-12 Pedro Alves * 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 --Boundary-00=_6xmQJ6w5fHzHdCL--