This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
dwarfread / multiple compilation units
- From: daniel dot van dot gerpen at philips dot com
- To: gdb at sources dot redhat dot com
- Date: Fri, 25 Jul 2003 21:35:22 +0100
- Subject: dwarfread / multiple compilation units
Hi,
I stumbled onto several problems using the Gnu Debugger 5.3 with code
from the Diab Compiler 4.4b.
One problem is the following:
The compiler option -Xsplit-section creates a separate section for each
function to allow the linker to remove it during linking when it is not
used. The option also splits the debug information for types into
different compilation units:
compilation unit A
[...]
00A14E46: TAG_typedef
| AT_sibling ref(0x00A14E67)
| AT_name "Cfoo"
| AT_user_def_type ref(0x00A14E67)
00A14E67: TAG_class_type
[...]
compilation unit B
00A160DE: TAG_compile_unit
| AT_sibling ref(0x00A16397)
| AT_name "../SRC/main.cpp"
| AT_low_pc adr(0x41EF5140)
| AT_high_pc adr(0x41EF52E8)
| AT_producer "Diab Data, Inc:dplus Rel 4.4b:PPC860"
| AT_language LANG_C_PLUS_PLUS
| AT_comp_dir
| AT_stmt_list 00 05 7D A6
| AT_source_file_names 0x00007734
| AT_source_info 0x00012EF0
| AT_main_unit ref(0x00A08C6A)
00A1618D: TAG_global_subroutine
| AT_sibling ref(0x00A16393)
| AT_name "bar"
[...]
00A161EB: TAG_lexical_block
| AT_sibling ref(0x00A16231)
| AT_low_pc adr(0x41EF51E4)
| AT_high_pc adr(0x41EF5204)
00A16203: TAG_local_variable
| AT_sibling ref(0x00A1622D)
| AT_name "foo"
| AT_user_def_type ref(0x00A14E46) /* reference into
compilation unit A */
[...]
In dwarfread.c the function lookup_utype() now complains about a bad die
reference, because read_ofile_symtab() only reads the dies from one
compilation unit (unit B). The result is that gdb only shows the variable
"foo" to be of type "int" instead of type "Cfoo".
Maybe someone already has a patch for this?
If not, what would be an appropriate solution? I have been pondering about
a
possible fix. To read all dies from all compilation units could be a
problem
for code with a huge amount of debug information.
A better way would be to reload the missing information when it is needed.
But I am not sure how to load dies from other compilation units for
example
in lookup_utype().
Daniel van Gerpen