This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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]

circular reference chains with DW_AT_containing_type


Hi,

I finally fully implemented the dwarf_output hashing algorithm, with a
local hash that depends only on non-reference attributes and the local
hash of the children of a die, and a reference hash that depends on the
local hashes of all reference attributes (recursively) of the die.

This does reduce the number of attr_set hash collisions a lot.
Unfortunately there are circular reference chains for some larger c++
programs. That was unexpected. Here is an example running dwarfcmp-test
on itself:

$ src/dwarfcmp-test -T src/dwarfcmp-test src/dwarfcmp-test
Reference chain cycle detected
offset=[0x2898c8] already on the reference chain stack
offset=[0x2889cb] subprogram
offset=[0x2959bd] reference_type
offset=[0x289b7c] structure_type
offset=[0x2898c8] structure_type
Aborted (core dumped)

And offset=[0x2898c8] is:

  <structure_type offset=[0x2898c8]
                  specification=[0x28889b]
                  byte_size=0x8
                  decl_file="...libdw/c++/dwarf_data" decl_line=761
                  containing_type=[0x2898c8]>
  
Is this valid dwarf? Can a structure_type have a containing_type? A
strict reading of the dwarf4 spec seems to imply only a
DW_TAG_ptr_to_member_type may have a DW_AT_containing_type.

Not yet sure how to handle this case. The original algorithm depended on
the reference chain not being cyclic on its own (when ignoring
children). Obviously that isn't true in at least this case.

Code, plus cycle detection is on mjw/dwarf_output branch.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]