searching for source directories in GDB

What you need for this is the command set substitute-path.

    (gdb) set substitute-path /usr/src/include /mnt/include

Only available in recent versions (6.6+) of gdb, though.


Or you can do something like this, for debugging program prog with source in directory srcdir:

gdb `find srcdir -type d -printf '-d %p '` prog

I think it's a more direct answer to your question. Also useful if your executable doesn't contain the compilation directories and/or you don't have version 6.6+ of gdb.

Tags:

Debugging

Gdb