This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Using gdb with emacs
The debug info recorded in the executable says that one of the source
files is ../foo/bar/baz.c. How can GDB know that a file you are
visiting, whose absolute file name is /home/user/project/foo/bar/baz.c,
is that file?
If the files named baz.c have full names ../foo/bar/baz.c and
../foo/lose/baz.c, GDB could figure out that
/home/user/project/foo/bar/baz.c, must be the former rather than the
latter. It could move up in the file names, eliminating possibilities
when it sees a mismatch, and if at some point only one file name still
remains undisqualified, that is the one.
Because gcc, for each .o file (at least when using stabs) emits
*both* the relative filename *and* the current working directory.
So gdb can calculete the absolute filename.
It can do that, and that may be one good thing to try; but that may
not be the full solution. It is not unusual to move directories
around; when that has happened, this method would fail just like now.
Perhaps it should first try to recognize the absolute file name,
and then, if that fails, try what I suggested above.