public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: New gdbserver failures
Date: Mon, 12 Apr 2010 17:45:00 -0000	[thread overview]
Message-ID: <201004121844.44111.pedro@codesourcery.com> (raw)
In-Reply-To: <201004121559.53141.pedro@codesourcery.com>

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  <pedro@codesourcery.com>

	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,

      reply	other threads:[~2010-04-12 17:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12 14:48 H.J. Lu
2010-04-12 14:54 ` H.J. Lu
2010-04-12 15:00 ` Pedro Alves
2010-04-12 17:45   ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201004121844.44111.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).