This is the mail archive of the mailing list for the Insight 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: Can't find source files

Dave Korn wrote, On 10/12/2004 10:10 AM:
-----Original Message-----
From: insight-owner On Behalf Of geneSmith
Sent: 12 October 2004 14:31

Dave Korn wrote, On 10/12/2004 5:04 AM:

-----Original Message-----
From: insight-owner On Behalf Of geneSmith
Sent: 11 October 2004 23:26

If you set directory to:


and your $cdir is /home/gene/source

where d is a samba drive mapped to /

Is there a reason why insight/gdb would not find the files at

/cygdrive/d/home/gene/source ?

? I can't see anything in the gdb docs that suggests it

would concatenate $cdir to $cwd. Where do you get that from ?

What I am implying is that gdb concatentates the paths specified by "directory" with the path to the source file contained in the object file as described in Debugging with GDB section 7.4, Specifying source directories.

  That's the same bit I read.  Where do you see the word 'concatenate' in

(Maybe I dont' completely know the meaining of $cdir?)

  I think you're making a false assumption about how path searching works.

"   When you start GDB, its source path includes only `cdir' and `cwd',
in that order.  To add other directories, use the `directory' command. "

  So, in your case, the source path will include "/home/gene/source" ($cdir,
the compilation dir) and "/cygdrive/d", your current directry ($cwd).  Now
read the bit about how the path search operates:

"  GDB has a list of directories to search for
source files; this is called the "source path".  Each time GDB wants a
source file, it tries all the directories in the list, in the order
they are present in the list, until it finds a file with the desired
name.  "

  So, first gdb looks for your source file in "/home/gene/source", then it
looks in "/cygdrive/d".  Neither of those are the path to your source file,
so it doesn't find it.  At no time does it start concatenating the different
directories in the source path.  It won't look in
/cygdrive/d/home/gene/source.  It won't look in /home/gene/source/cygdrive/d
either, which is what you're suggesting it should do, but is more obviously

This is all just the same as how $PATH works in your shell. If you have


you wouldn't expect it to find executables in /bin/usr/bin, would you?

cheers, DaveK


The 9th Edition of "Debugging with GDB" on page 61 also states:

"For example, suppose an executable references the file ‘/usr/src/foo-1.0/lib/foo.c’,
and our source path is ‘/mnt/cross’. The file is first looked up literally; if this fails,‘/mnt/cross/usr/src/foo-1.0/lib/foo.c’ is tried; if this fails, ‘/mnt/cross/foo.c’ is
opened; if this fails, an error message is printed."

I think this is right after where you quoted. I have seen this work in some cases but not for the one I mention (or possibly it's still a user error).

It does not explicitly say "concatentate" but that seem like what the middle example is, /mnt/cross/usr/src/foo-1.0/lib/foo.c .

Lit up like Levy's

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