gcc may emit relative directory name for some included files. While debugging programs which have dwarf2 debug information and are not in the build hierarchy (i.e. installed to other location) gdb fails to find such included files though all needed information (source directory et al) is available. Reproducible: Always Steps to Reproduce: 1. Build a package which uses relative include paths and install resulting binary somewhere outside build directory. 2. Start a gdb session, then try to single-step into function which is implemented in #included file. Actual Results: gdb say "No such file or directory" for such a file. Expected Results: Included file should be correctly located. This problem is addressed in a message thread resulting in a patch by Bryce McKinlay, see http://sources.redhat.com/ml/gdb-patches/2004-07/msg00456.html for details. So this probably would be in the next released gdb, but it is not yet available in current gdb CVS.
Created attachment 40447 [details, diff] A patch by Bryce McKinlay rediffed against gdb-6.2.1 A patch by Bryce McKinlay mentioned in desc, rediffed against gdb-6.2.1 I successively use gdb-6.2.1 with this patch and do not see this problem.
Created attachment 40448 [details] test case to verify this bug To check please unpack a test case, then cd to gdb-relative-test and do export WANT_AUTOMAKE=1.8 autoreconf -i ./configure -v --prefix=`/bin/pwd`/inst make install then execute gdb as follows: LD_LIBRARY_PATH=`/bin/pwd`/inst/lib gdb inst/bin/hello then at gdb prompt do break main run step step here you either see "9 aa.hh: No such file or directory" which means gdb fails to find included file, or you do not see the error and "list" command would display the correct source code lines from included file
Created attachment 40738 [details, diff] Alternative patch with relation to compilation directory As I'm reading dwarf standard, relative paths should be handled in relation to compilation directory. This alternative patch does exactly this everywhere relative path entry is found in dwarf directory table. This patch makes some gdb testsuite failures. Now I strongly believe testsuite should be somewhat fixed in relative paths handling :)
added patch to 6.2.1-r1, thanks