Alex Rivera | Logout

searching for source directories in GDB

Asked 2009-07-09T10:51:50.730
29

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.

Edit
Report

1 Answer

18

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.

answered 2009-11-18T15:17:55.033

Your Answer