Searching for source directories in GDB

debugginggdb

How do I tell GDB in *nix to search for source files inside a single directory recursively?
For example:

  • if there are some different building blocks in one module.
  • a is parent directory for b, c, d where b,c,d are child directories.
  • source files are distributed in b,c,b.

I would need to specify to GDB that all the source files are located in 'a'(parent directory) which GDB should use as a reference and search for source files recursively while debugging a program.

Best Answer

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.