searching for source directories in GDB

debugging, gdb

Solution

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.

Problem

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.

Original source