public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* dwarfread / multiple compilation units
@ 2003-07-25 22:42 daniel.van.gerpen
  2003-07-25 23:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: daniel.van.gerpen @ 2003-07-25 22:42 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dwarfread / multiple compilation units
  2003-07-25 22:42 dwarfread / multiple compilation units daniel.van.gerpen
@ 2003-07-25 23:08 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2003-07-25 23:08 UTC (permalink / raw)
  To: daniel.van.gerpen; +Cc: gdb

On Fri, Jul 25, 2003 at 09:35:22PM +0100, daniel.van.gerpen@philips.com wrote:
> 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:


> 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().

This will be extremely hard to fix.

The DWARF-2 reader has the same problem, and I or someone else will see
that it gets fixed.  But it is unlikely that any of the maintainers
will put in that much effort for the DWARF 1 reader.

Really, kick your compiler vendor.  DWARF 2 is a good number of years
old now.  They should switch.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-25 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-25 22:42 dwarfread / multiple compilation units daniel.van.gerpen
2003-07-25 23:08 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).