This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
symtab/1713: GDB doesn't know about source files specified with #line
- From: frank at jrware dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 17 Jul 2004 21:59:54 -0000
- Subject: symtab/1713: GDB doesn't know about source files specified with #line
- Reply-to: frank at jrware dot com
>Number: 1713
>Category: symtab
>Synopsis: GDB doesn't know about source files specified with #line
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Jul 17 22:08:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: frank@jrware.com
>Release: gdb 6.1-debian (i486-linux, powerpc-linux)
>Organization:
>Environment:
gcc 3.3.3 (i486-linux, powerpc-linux)
>Description:
Source files specified with "#line" preprocessor directives are not recognized, i.e. you can't set break points using those file names.
However, if program execution stops near the "#line" directive, the "#line"-specified source files are recognized. This seems to indicate a flaw in the initialization of the valid source file list which is corrected once execution of the program by gdb has begun.
This behavior effects debugging generated source code, where fragments of handwritten source are embedded in generated code and surrounded by "#line" directives. It is useful to be able to set break points using the original source code files and line numbers eventhough that source code was embedded in generated code during the compile
>How-To-Repeat:
Compile "t.c": gcc -g t.c
Create file "incfile.c" with the following lines:
printf ("Goodbye, world!\n");
printf ("Goodbye, again!\n");
Run gdb: gdb a.out
(gdb) break incfile.c:1
No source file named incfile.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) break t.c:7
Breakpoint 1 at 0x1000040c: file t.c, line 7.
(gdb) run
Starting program: /home/frank/a.out
Breakpoint 1, main () at t.c:7
7 printf ("Hello, world!\n");
(gdb) break incfile.c:1
Breakpoint 2 at 0x1000041c: file incfile.c, line 1.
In summary, the first attempt to break in "incfile.c" fails, but the second works. It probably should work the first time as well.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="t.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="t.c"
I2luY2x1ZGUgPHN0ZGlvLmg+CgptYWluICgpCnsKCWludAkJbXl2YXIxOwoKCXByaW50ZiAoIkhl
bGxvLCB3b3JsZCFcbiIpOwoKIwlsaW5lIDEgImluY2ZpbGUuYyIKCXByaW50ZiAoIkdvb2RieWUs
IHdvcmxkIVxuIik7CglwcmludGYgKCJHb29kYnllLCBhZ2FpbiFcbiIpOwp9Cg==