summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_highpc.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-22 14:34:06 +0200
committerMark Wielaard <[email protected]>2018-05-25 15:10:40 +0200
commite7765da2aebf919bf3ab8480ac07ccdee42aaf8d (patch)
treebe455dd507a73736b72a5b86d223a603f23d0fde /libdw/dwarf_highpc.c
parent6e3d2521a2b5a3b436901f52cfb9785887a7c961 (diff)
libdw: Handle all address FORMs for dwarf_highpc, handle errors better.
dwarf_highpc can use any address FORM, not just DW_FORM_addr. Just try whether the address can be resolved as address. Always set error when attribute couldn't be found or resolved. When calculating the base address for a CU don't try to second guess the error code, just treat an error the same as the attribute not being there. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_highpc.c')
-rw-r--r--libdw/dwarf_highpc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libdw/dwarf_highpc.c b/libdw/dwarf_highpc.c
index 1baffa7e..5b2f0fd6 100644
--- a/libdw/dwarf_highpc.c
+++ b/libdw/dwarf_highpc.c
@@ -47,10 +47,10 @@ dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
attr_high = INTUSE(dwarf_attr) (die, DW_AT_high_pc, &attr_high_mem);
if (attr_high == NULL)
- return -1;
+ goto no_addr;
- if (attr_high->form == DW_FORM_addr)
- return INTUSE(dwarf_formaddr) (attr_high, return_addr);
+ if (INTUSE(dwarf_formaddr) (attr_high, return_addr) == 0)
+ return 0;
/* DWARF 4 allows high_pc to be a constant offset from low_pc. */
if (INTUSE(dwarf_lowpc) (die, return_addr) == 0)
@@ -61,8 +61,10 @@ dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
*return_addr += uval;
return 0;
}
- __libdw_seterrno (DWARF_E_NO_ADDR);
}
+
+no_addr:
+ __libdw_seterrno (DWARF_E_NO_ADDR);
return -1;
}
INTDEF(dwarf_highpc)