how do i mention to gdb in unix to search for source files inside a single directory recursively for example if there are some different buiding blocks in one module. a is parent directory for b, c, d where b,c,d are child directories. and source files are distributed in b,c,b. i just have to mention to gdb that all the source files are located in a(parent directory). which gdb will use as a reference and search for source files recursively while debugging a program.
+1
A:
(gdb) help files Specifying and examining files.
List of commands:
add-shared-symbol-files -- Load the symbols from shared objects in the dynamic linkers link map
add-symbol-file -- Load symbols from FILE
add-symbol-file-from-memory -- Load the symbols out of memory from a dynamically loaded object file
cd -- Set working directory to DIR for debugger and program being debugged
core-file -- Use FILE as core dump for examining memory and registers
directory -- Add directory DIR to beginning of search path for source files
edit -- Edit specified file or function
exec-file -- Use FILE as program for getting contents of pure memory
file -- Use FILE as program to be debugged
forward-search -- Search for regular expression (see regex(3)) from last line listed
generate-core-file -- Save a core file with the current state of the debugged process
(gdb) help directory
Add directory DIR to beginning of search path for source files.
Forget cached info on source file locations and line positions.
DIR can also be $cwd for the current working directory, or $cdir for the
directory in which the source file was compiled into object code.
With no argument, reset the search path to $cdir:$cwd, the default.
RandomNickName42
2009-07-14 02:49:54
A:
sorry i dont think this answers my question..could you tell me taking an example
Vijay Sarathi
2009-07-21 15:18:06
+1
A:
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.
soru
2009-08-25 10:21:03
+1
A:
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.
Sam Brightman
2009-11-18 15:17:55