From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28522 invoked by alias); 13 Dec 2005 22:58:07 -0000 Received: (qmail 28512 invoked by uid 22791); 13 Dec 2005 22:58:07 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 13 Dec 2005 22:58:05 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1EmJ5u-0003rq-O5; Tue, 13 Dec 2005 17:58:02 -0500 Date: Tue, 13 Dec 2005 22:58:00 -0000 From: Daniel Jacobowitz To: Andreas Schwab Cc: gdb@sourceware.org Subject: Re: Race condition in attach command Message-ID: <20051213225802.GA14796@nevyn.them.org> Mail-Followup-To: Andreas Schwab , gdb@sourceware.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00149.txt.bz2 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 (¤t_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 (¤t_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 (¤t_target, from_tty); + #ifdef SOLIB_ADD /* Add shared library symbols from the newly attached process, if any. */ SOLIB_ADD ((char *) 0, from_tty, ¤t_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 (¤t_target, from_tty); } #if !defined(CHILD_POST_ATTACH)