This is the mail archive of the 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: Finding absolute path from relative.

> Date: Sun, 28 Sep 2003 22:44:37 -0400
> From: Bob Rossi <>
> Another quick question. I have been told that some of the debug formats
> support absolute paths and some do not.

True.  COFF is one example of debug info format that stores only the
file name, without the leading directories.

However, even with more advanced debug formats, such as DWARF2, the
file name stored in the debug info might exclude the leading
directories, depending on how the source file was specified to the
compiler during compilation.  E.g., try

      gcc -c foo.c
      gcc -c /full/path/to/foo.c

and then use objdump to look at the file name recorded in foo.o's
debug info.

> Does this just mean that some
> of the debug formats will give you the absolute path, and with the
> others, this expensive lookup is necessary?
> I guess the question is, in both cases, can GDB find the absolute path
> to a source file, given only the relative path?

I'm not sure this problem is solvable at all, in all cases.  If the
leading directories are not recorded in the debug info, the assumption
that the file is somewhere along the list of known source directories
might not always hold, as GDB has no way of setting the list of those
directories automatically.

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