From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14821 invoked by alias); 26 Jul 2002 17:17:51 -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 14812 invoked from network); 26 Jul 2002 17:17:49 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 26 Jul 2002 17:17:49 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id 0561F5EA11; Fri, 26 Jul 2002 12:17:47 -0500 (EST) To: david carlton Cc: gdb-patches@sources.redhat.com Subject: Re: gdbinit.in References: <15680.37429.703834.710341@jackfruit.Stanford.EDU> From: Jim Blandy Date: Fri, 26 Jul 2002 11:17:00 -0000 In-Reply-To: <15680.37429.703834.710341@jackfruit.Stanford.EDU> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-07/txt/msg00534.txt.bz2 david carlton writes: > When debugging GDB, if I'm looking at a function in corefile.c, it > finds the one in bfd/corefile.c rather than the one in gdb/corefile.c. > This is because, in the .gdbinit that is created in the gdb directory, > the 'dir ./../bfd' command comes later than the 'dir .' command. This > seems to me to be undesirable behavior; the accompanying patch to > gdbinit.in changes that. > > I've moved both 'dir @srcdir@' and 'dir .' to the end of the dir > list. Certainly I want 'dir @srccdir@' to be towards the end. I > don't really have a strong opinion about where 'dir .' should be > - honestly, it's not entirely clear to me why it's there at all. > (@srcdir@ is . when I'm configuring this, so I don't see the > difference.) The directory list maintained by the `dir' command only helps GDB find source files for code listings. It doesn't affect the order in which GDB searches the symtabs for a source file of a given name. In the example below, note that, no matter how I have my dir list set up, I always get the breakpoint in BFD. $ cat .gdbinit echo Setting up the environment for debugging gdb.\n set complaints 1 b internal_error b info_command commands silent return end dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb dir . dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../mmalloc dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../libiberty dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../bfd set prompt (top-gdb) $ gdb -nw gdb GNU gdb 2002-07-16-cvs Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... Setting up the environment for debugging gdb. Breakpoint 1 at 0x80f5e74: file /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/utils.c, line 747. Breakpoint 2 at 0x8176e08: file /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/cli/cli-cmds.c, line 184. (top-gdb) break corefile.c:68 Breakpoint 3 at 0x81809a0: file /home/jimb/cygnus/src/sourceware/gdb/main/src/bfd/corefile.c, line 68. (top-gdb) $ $ cat .gdbinit echo Setting up the environment for debugging gdb.\n set complaints 1 b internal_error b info_command commands silent return end dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../mmalloc dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../libiberty dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/../bfd dir /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb dir . set prompt (top-gdb) $ gdb -nw gdb GNU gdb 2002-07-16-cvs Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... Setting up the environment for debugging gdb. Breakpoint 1 at 0x80f5e74: file /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/utils.c, line 747. Breakpoint 2 at 0x8176e08: file /home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/cli/cli-cmds.c, line 184. (top-gdb) break corefile.c:68 Breakpoint 3 at 0x81809a0: file /home/jimb/cygnus/src/sourceware/gdb/main/src/bfd/corefile.c, line 68. (top-gdb) I'm not sure how to solve the actual problem you're seeing. Does it work to use an absolute path?