This is the mail archive of the gdb@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: Race condition in attach command


On Tue, Dec 13, 2005 at 11:53:17PM +0100, Andreas Schwab wrote:
> It seems like the attach command a timing bug.  The problem is that when I
> attach to a process I often see that gdb cannot read the vDSO image from
> the process.  When enabling infrun debugging I see that gdb tries to read
> the image before the process has actually stopped.  I'm observing that
> both on ppc64-linux and ia64-linux, with gdb 6.4 and current trunk.

Yes, I know exactly what causes this - it was a recent (ish) reorganization
of the observers, I believe.  I have this queued up to submit; does it
help for you?

-- 
Daniel Jacobowitz
CodeSourcery, LLC

Index: gdb-6.4/gdb/inf-ptrace.c
===================================================================
--- gdb-6.4.orig/gdb/inf-ptrace.c	2005-11-21 04:16:07.000000000 -0500
+++ gdb-6.4/gdb/inf-ptrace.c	2005-12-11 13:08:51.000000000 -0500
@@ -228,10 +228,6 @@ inf_ptrace_attach (char *args, int from_
 
   inferior_ptid = pid_to_ptid (pid);
   push_target (ptrace_ops_hack);
-
-  /* Do this first, before anything has had a chance to query the
-     inferior's symbol table or similar.  */
-  observer_notify_inferior_created (&current_target, from_tty);
 }
 
 #ifdef PT_GET_PROCESS_STATE
Index: gdb-6.4/gdb/inf-ttrace.c
===================================================================
--- gdb-6.4.orig/gdb/inf-ttrace.c	2005-10-29 17:22:39.000000000 -0400
+++ gdb-6.4/gdb/inf-ttrace.c	2005-12-11 13:10:29.000000000 -0500
@@ -727,10 +727,6 @@ inf_ttrace_attach (char *args, int from_
 
   inferior_ptid = pid_to_ptid (pid);
   push_target (ttrace_ops_hack);
-
-  /* Do this first, before anything has had a chance to query the
-     inferior's symbol table or similar.  */
-  observer_notify_inferior_created (&current_target, from_tty);
 }
 
 static void
Index: gdb-6.4/gdb/infcmd.c
===================================================================
--- gdb-6.4.orig/gdb/infcmd.c	2005-12-07 20:37:42.000000000 -0500
+++ gdb-6.4/gdb/infcmd.c	2005-12-11 13:09:33.000000000 -0500
@@ -1878,6 +1878,10 @@ attach_command (char *args, int from_tty
       reread_symbols ();
     }
 
+  /* Do this first, before anything has had a chance to query the
+     inferior's symbol table or similar.  */
+  observer_notify_inferior_created (&current_target, from_tty);
+
 #ifdef SOLIB_ADD
   /* Add shared library symbols from the newly attached process, if any.  */
   SOLIB_ADD ((char *) 0, from_tty, &current_target, auto_solib_add);
Index: gdb-6.4/gdb/inftarg.c
===================================================================
--- gdb-6.4.orig/gdb/inftarg.c	2005-09-04 12:18:19.000000000 -0400
+++ gdb-6.4/gdb/inftarg.c	2005-12-11 13:10:37.000000000 -0500
@@ -211,10 +211,6 @@ child_attach (char *args, int from_tty)
   
   inferior_ptid = pid_to_ptid (pid);
   push_target (&deprecated_child_ops);
-
-  /* Do this first, before anything has had a chance to query the
-     inferior's symbol table or similar.  */
-  observer_notify_inferior_created (&current_target, from_tty);
 }
 
 #if !defined(CHILD_POST_ATTACH)


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