From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14625 invoked by alias); 23 Mar 2004 15:50:53 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14603 invoked from network); 23 Mar 2004 15:50:51 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 23 Mar 2004 15:50:51 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B5oB0-00057r-Hh; Tue, 23 Mar 2004 10:50:50 -0500 Date: Tue, 23 Mar 2004 15:50:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa/remote] Reread symbols on 'target remote' Message-ID: <20040323155049.GA21830@nevyn.them.org> Mail-Followup-To: Andrew Cagney , gdb-patches@sources.redhat.com References: <20040228173955.GA15910@nevyn.them.org> <404810C2.8050005@gnu.org> <20040306235436.GA10071@nevyn.them.org> <40586BC3.1080706@gnu.org> <20040317165115.GA8390@nevyn.them.org> <405F68A0.3060300@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <405F68A0.3060300@gnu.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00520.txt.bz2 On Mon, Mar 22, 2004 at 05:28:48PM -0500, Andrew Cagney wrote: > > >>>While "run" and "load" are fairly obvious sync points for GDB and its > >>>executable I'm not sure that "target remote" is - it's behavior is kind > >>>of sort of a screwed up version of attach. > >>> > >>>What does that do (as far as I can tell it doesn't re-read symbols)? > > > > > >I think you're right - attach won't reread symbols either. I believe > >run is the only current sync point. My instinct is that target remote > >and attach both ought to be - I know that if I'm debugging something > >that needs to be started in a separate environment and attached to, and > >I detach, rebuilt, re-attach, I'd be confused if GDB didn't > >auto-reload. I know I've tried to do the same thing for target remote, > >and expected GDB to reload - it didn't, and it took me a while to work > >out what the problem was. > > > >We should probably be consistent. Want me to get attach too? > > Well attach is more messed up than that. It might load the symbol table > (if it isn't already loaded and can be determined from /proc). Should > attach instead always load the symbol table, prefering what is provided > by the executable? If I'm reading you right - then I think the answer is yes. What's your opinion on the patch below? If there is no exec file, then attempt to determine one from target_pid_to_exec_file. Otherwise, attempt to reread the exec file. > (meanwhile the remote change might as well go in to mainline) OK, checked in. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2004-03-23 Daniel Jacobowitz * infcmd.c (attach_command): Reread symbols if we already have an exec file. Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.105 diff -u -p -r1.105 infcmd.c --- infcmd.c 14 Feb 2004 17:26:35 -0000 1.105 +++ infcmd.c 23 Mar 2004 15:47:33 -0000 @@ -1843,6 +1843,11 @@ attach_command (char *args, int from_tty symbol_file_add_main (full_exec_path, from_tty); } } + else + { + reopen_exec_file (); + reread_symbols (); + } #ifdef SOLIB_ADD /* Add shared library symbols from the newly attached process, if any. */