These functions will currently search the DIE referenced by a
DW_AT_abstract_origin attribute for a DW_AT_type attribute. GCC 6 plus
ctfconvert turned up some problems with this:
- libdwarf will crash if asked to fetch the value of DW_AT_type and neither DW_AT_type or DW_AT_abstract_origin are present in the DIE.
- GCC 6 emits variable DIEs whose type is defined in the DIE referenced by a DW_AT_specification attribute. ctfconvert fails process such DIEs since it doesn't know to follow DW_AT_specification attributes.
- We might have to traverse multiple DIEs to find a DW_AT_type value.
- The documentation states that libdwarf will search referenced DIEs for any attribute, but it only searches for DW_AT_type. Note that DW_AT_abstract_origin is used in multiple DIE types; the intent here seems to be to allow lookups for DW_TAG_formal_parameter DIEs.
This change addresses these issues. I think it would also make sense to
allow lookups of DW_AT_name this way, but did not implement that. In
particular, it would allow some simplification of addr2line and nm.
I'm not sure what the original motivation for this handling is. It seems to
be present in the first revision of dwarf_attrval.c.