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]

[Bug libdw/23981] New: dwarf_siblingof() fails with attribute form DW_FORM_ref_addr


https://sourceware.org/bugzilla/show_bug.cgi?id=23981

            Bug ID: 23981
           Summary: dwarf_siblingof() fails with attribute form
                    DW_FORM_ref_addr
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: Andreas.Kromke at dreamchip dot de
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

The API function dwarf_siblingof() internally calls __libdw_formref() which is
deprecated and especially does not support DW_FORM_ref_addr, resulting in a
return code of -1 (format error).

Instead dwarf_siblingof() should call dwarf_formref_die() or an internal
variant of that.

A temporary workaround might be:

int my_dwarf_siblingof(Dwarf_Die *die, Dwarf_Die *result) {
    int ret = dwarf_siblingof(die, result);
    if (ret >= 0) return ret;
    Dwarf_Attribute attr_result;
    Dwarf_Attribute *attr = dwarf_attr(die, DW_AT_sibling, &attr_result);
    if (attr == NULL) return -1;
    Dwarf_Die *formref_die = dwarf_formref_die(attr, result);
    if (formref_die == NULL) return -1;
    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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