This is called the source path Each time gdb wants a source file, it tries all the directories in the list, in the order they are present in the list, until it finds a file with the desired name. How to make gdb to use different directory to look for source files For example my source file during the compilation was in directory Now, when you have source level info go and explore something Resources introduction to the dwarf debugging format gdb doc on source path
Add directory dirname to the front of the source path Several directory names may be given to this command, separated by `:' or whitespace You may specify a directory that is already in the source path This moves it forward, so gdb searches it sooner. It wasn't clear to me how gdb handled file/line breakpoints and if clients (us) have to do the reverse mapping [.m] cpptools/cppdbg added support for source maps.
Note that the executable search path is not used for this purpose. I have gdb attached to a process and just stopped at a function breakpoint Unfortunately i can't see any source code since the mapping seems to be off The file it looks for reports as
WATCH