This is the mail archive of the gdb-patches@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: [RFC] Fix a bug in source file searching


On 03/31/2010 06:14 AM, Tom Tromey wrote:
"Jie" == Jie Zhang<jie@codesourcery.com> writes:

Jie> I found this bug when debugging GCC. (Actually I don't know if this is Jie> a bug in GDB code or documentation.) I prepared a patch so you can Jie> easily comment.

Thanks.

Jie>  And .gdbinit file in GCC build directory has
Jie>     dir ../../../svn/trunk/gcc/fortran
Jie>  So it looked GDB searched pathes added by dir command first.

Jie>  But the GDB documentation says in "9.5 Specifying Source Directories":
Jie>  [quote]
Jie>  For example, suppose an executable references the file
Jie>  /usr/src/foo-1.0/lib/foo.c, and our source path is /mnt/cross. The
Jie>  file is first looked up literally; if this fails,
Jie>  /mnt/cross/usr/src/foo-1.0/lib/foo.c is tried; if this fails,
Jie>  /mnt/cross/foo.c is opened; if this fails, an error message is
Jie>  printed.
Jie>  [/quote]

Maybe the documentation is just wrong or misleading here.  I say that
because the special entry `$cdir' expands to the compilation directory,
and you can control where this appears pretty easily.

Maybe I misunderstood the document. I thought

comp_dir = /usr/src/foo-1.0
filename = lib/foo.c

should be same as

comp_dir =
filename = /usr/src/foo-1.0/lib/foo.c

Obviously GDB treats them differently although I don't know why.

And I don't know why GCC adds those dir commands in its .gdbinit. I will ask on GCC mailing list.

--
Jie Zhang
CodeSourcery
(650) 331-3385 x735


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