GDB source path

debugging, gdb, path

Solution

set substitute-path /home/foo /tmp/debug/home/foo

http://sourceware.org/gdb/current/onlinedocs/gdb/Source-Path.html#index-set-substitute_002dpath

Problem

How to make gdb to use different directory to look for source files. For example my source file during the compilation was in directory: ``` /home/foo/bar.c ``` Next, I moved it into directory: ``` /tmp/debug/home/foo/bar.c ``` How to enforce gdb to search in this directory? According to this site I should just use command: ``` dir /tmp/debug/ ``` But it is not working. I get a message `foo.c: "No such file or directory"` from gdb.

Original source