gdb/1970: gdb can't find files #included source files after cd (linux, gcc3.3/3.4)

vince.delvecchio@analog.com vince.delvecchio@analog.com
Thu Jul 14 19:08:00 GMT 2005


>Number:         1970
>Category:       gdb
>Synopsis:       gdb can't find files #included source files after cd (linux, gcc3.3/3.4)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 14 19:08:00 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     vince.delvecchio@analog.com
>Release:        GNU gdb 6.3
>Organization:
>Environment:
Linux Fedora Core 3, gcc 3.4.3 (Fedora native) or 3.3.4
gdb 6.3, also 6.1post-1.20040607.43rh and 6.3.50.20050714
>Description:
When part of the source is in an file that was #included with a relative path, gdb can't seem to find the source for the include file if the current directory changes.
>How-To-Repeat:
(echo '#include "foo.h"'; echo 'main(){foo();}') > foo.c
mkdir inc
echo 'int foo(){return 0;}' > inc/foo.h
gcc -g -Iinc foo.c -o foo
mkdir tst
cd tst
gdb ../foo
b main
r
s

gdb prints:
Breakpoint 1, main () at foo.c:2
2       main(){foo();}
(gdb) s
foo () at foo.h:1
1       foo.h: No such file or directory.
        in foo.h

If you then "cd .." within gdb, it finds it; cd somewhere else and it loses it again.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list