On Mon, 2011-02-21 at 15:23 +0100, Mark Wielaard wrote:
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.
For reference, this is the top of reference chain leading to this
self-referential containing_type:
<subprogram offset=[0x2889cb]
external=1
name="variant<elfutils::dwarf_data::value<elfutils::dwarf_edit,
true>::value_flag>"
decl_file="/home/mark/src/elfutils/libdw/c++/dwarf_data"
decl_line=779
MIPS_linkage_name="<...some_giant_string...>"
type=[0x2959bd]
declaration=1>
<reference_type offset=[0x2959bd]
byte_size=0x8
type=[0x289b7c]/>
<structure_type offset=[0x289b7c]
specification=[0x2888bf]
byte_size=0x10
decl_file="/home/mark/src/elfutils/libdw/c++/dwarf_data"
decl_line=882
containing_type=[0x2898c8]>