This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, This is a followup on: [RFC/dwarf-2] Add support for included files http://sources.redhat.com/ml/gdb-patches/2004-01/msg00015.html Here is a reproducer in C, which mimics a situation that is much more common on Ada (the notion of "separates"). hello.c: void say_hello (void) { printf ("Hello world.\n"); } foo.c: #include <stdio.h> #include "hello.c" <--- Reproduces the "is separate"... int main (void) { say_hello (); return 0; } We have noticed that, if compiled with dwarf-2, GDB is unable to set a breakpoint inside hello.c using the file:lineno syntax: % gcc -gdwarf-2 foo.c -o foo % gdb foo (gdb) b hello.c:4 No source file named hello.c. (gdb) list hello.c:4 No source file named hello.c. Based on the feedback from the thread referenced above, and some more thinking, I have chosen to keep the approach used in the my prototype, rather than trying to extract out the code in dwarf_decode_lines() that scans the Line Number Program and make it symtab-independent. I wasn't too keen on doing this because the profits versus the cost of doing this weren't too obvious to me. I also explored the possibility of keeping this function as is, and of calling it while building the partial symtabs. Unfortunately, a quick code inspection of buildsym.c conviced me that it is not obvious that this approach would work, and that it would probably break part of the encapsulation of that module. The main reason is that the buildsym.c module is making some assumptions about the context while being in use (that we are currently building full symbol tables), and playing with the context to force it to work in my context would create a fragile situation. 2004-02-24 J. Brobecker <brobecker@gnat.com> * dwarf2read.c (dwarf2_create_include_psymtab): New function. (dwarf2_build_include_psymtabs): New function. (read_partial_die): Add new parameter. Update call to itself. (add_file_name): Add forward declaration. (dwarf2_build_psymtabs_hard): Build the psymtabs for the included files as well. (psymtab_to_symtab_1): Build the symtabs of all dependencies as well. (scan_partial_symbols): Update call to read_partial_die(). (add_partial_structure): Likewise. (add_partial_enumeration): Likewise. (locate_pdi_sibling): Likewise. (dwarf_decode_lines): Add comment. Tested on x86-linux, no differences. I will submit a new testcase using the code above separately. OK to apply? Thanks, -- Joel
Attachment:
dwarf2read.c.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |