This is the mail archive of the gdb-patches@sources.redhat.com 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: gdbinit.in


david carlton <carlton@math.stanford.edu> 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?


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