This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New gdbserver failures


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,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]