From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2705 invoked by alias); 12 Apr 2010 17:45:07 -0000 Received: (qmail 2654 invoked by uid 22791); 12 Apr 2010 17:45:05 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Apr 2010 17:44:48 +0000 Received: (qmail 8069 invoked from network); 12 Apr 2010 17:44:46 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 12 Apr 2010 17:44:46 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: New gdbserver failures Date: Mon, 12 Apr 2010 17:45:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: "H.J. Lu" References: <201004121559.53141.pedro@codesourcery.com> In-Reply-To: <201004121559.53141.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004121844.44111.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: 2010-04/txt/msg00371.txt.bz2 On Monday 12 April 2010 15:59:53, Pedro Alves wrote: > On Monday 12 April 2010 15:48:03, H.J. Lu wrote: > > On Linux/x86-64, I saw > > > > FAIL: gdb.server/ext-attach.exp: attach to remote program 2 > > FAIL: gdb.server/ext-attach.exp: backtrace 2 > Thanks, I'll take a look. When I originaly added the target->mourn callback, I had a little back and forth deciding who should call remote_process, and ended up leaving things only half consistent ( if you know what I mean :-) ). The current problem is that linux_detach was mourning the inferior, but that was forgetting to also remove the process from the processes table. Targets other than linux would also be crashing, as the target->mourn callback was being called unconditionally... Duh on me. Anyway, this fixes it, and I've applied it, after confirming it fixes the regression, and after running the testsuite against gdbserver as well. Thanks. -- Pedro Alves 2010-04-12 Pedro Alves gdb/gdbserver/ * linux-low.c (linux_mourn): Also remove the process. * server.c (handle_target_event): Don't remove the process here. * nto-low.c (nto_mourn): New. (nto_target_ops): Install it. * spu-low.c (spu_mourn): New. (spu_target_ops): Install it. * win32-low.c (win32_mourn): New. (win32_target_ops): Install it. --- gdb/gdbserver/linux-low.c | 2 ++ gdb/gdbserver/nto-low.c | 8 +++++++- gdb/gdbserver/server.c | 5 +---- gdb/gdbserver/spu-low.c | 8 +++++++- gdb/gdbserver/win32-low.c | 8 +++++++- 5 files changed, 24 insertions(+), 7 deletions(-) Index: src/gdb/gdbserver/linux-low.c =================================================================== --- src.orig/gdb/gdbserver/linux-low.c 2010-04-12 18:06:02.000000000 +0100 +++ src/gdb/gdbserver/linux-low.c 2010-04-12 18:15:02.000000000 +0100 @@ -901,6 +901,8 @@ linux_mourn (struct process_info *proces free (priv->arch_private); free (priv); process->private = NULL; + + remove_process (process); } static void Index: src/gdb/gdbserver/server.c =================================================================== --- src.orig/gdb/gdbserver/server.c 2010-04-12 18:14:31.000000000 +0100 +++ src/gdb/gdbserver/server.c 2010-04-12 18:15:13.000000000 +0100 @@ -2999,10 +2999,7 @@ handle_target_event (int err, gdb_client if (last_status.kind == TARGET_WAITKIND_EXITED || last_status.kind == TARGET_WAITKIND_SIGNALLED) - { - mourn_inferior (process); - remove_process (process); - } + mourn_inferior (process); if (forward_event) { Index: src/gdb/gdbserver/nto-low.c =================================================================== --- src.orig/gdb/gdbserver/nto-low.c 2010-04-12 18:14:44.000000000 +0100 +++ src/gdb/gdbserver/nto-low.c 2010-04-12 18:18:17.000000000 +0100 @@ -406,6 +406,12 @@ nto_detach (int pid) return 0; } +static void +nto_mourn (struct process_info *process) +{ + remove_process (process); +} + /* Check if the given thread is alive. Return 1 if alive, 0 otherwise. */ @@ -900,7 +906,7 @@ static struct target_ops nto_target_ops nto_attach, nto_kill, nto_detach, - NULL, /* nto_mourn */ + nto_mourn, NULL, /* nto_join */ nto_thread_alive, nto_resume, Index: src/gdb/gdbserver/spu-low.c =================================================================== --- src.orig/gdb/gdbserver/spu-low.c 2010-04-12 18:14:41.000000000 +0100 +++ src/gdb/gdbserver/spu-low.c 2010-04-12 18:17:53.000000000 +0100 @@ -355,6 +355,12 @@ spu_detach (int pid) } static void +spu_mourn (struct process_info *process) +{ + remove_process (process); +} + +static void spu_join (int pid) { int status, ret; @@ -606,7 +612,7 @@ static struct target_ops spu_target_ops spu_attach, spu_kill, spu_detach, - NULL, /* mourn */ + spu_mourn, spu_join, spu_thread_alive, spu_resume, Index: src/gdb/gdbserver/win32-low.c =================================================================== --- src.orig/gdb/gdbserver/win32-low.c 2010-04-12 18:14:39.000000000 +0100 +++ src/gdb/gdbserver/win32-low.c 2010-04-12 18:17:14.000000000 +0100 @@ -763,6 +763,12 @@ win32_detach (int pid) return 0; } +static void +win32_mourn (struct process_info *process) +{ + remove_process (process); +} + /* Wait for inferiors to end. */ static void win32_join (int pid) @@ -1752,7 +1758,7 @@ static struct target_ops win32_target_op win32_attach, win32_kill, win32_detach, - NULL, + win32_mourn, win32_join, win32_thread_alive, win32_resume,