The functionality change is fine. Needs a NEWS item.
Don't make the same dwarf_attr call twice. If it fails,
return immediately.
I'm not sure you should use dwarf_formaddr for a case that might not work,
since we get an extra __libdw_seterrno call when the user's call succeeds.
I don't know off hand if we have clear precedent about that issue. But
here it's easy enough just to check attr->form for DW_FORM_addr.
If dwarf_formudata fails I don't think we should return with
DWARF_E_NO_CONSTANT, since the user asked for an address, not a constant.
Probably simplest just to add a
__libdw_seterrno (DWARF_E_NO_ADDR);
in that error case.
Also, please look at the relocate branch for how this can be handled there,
so the branch (including new interfaces) doesn't regress from trunk in
subtle ways. I think the only change needed is dwarf_ranges_relocatable,
but that seems like it could be nontrivial.
Thanks,
Roland