summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_ranges.c
diff options
context:
space:
mode:
authorPetr Machata <[email protected]>2015-02-11 22:11:46 +0100
committerPetr Machata <[email protected]>2015-02-11 22:11:46 +0100
commitb4da85ded5de790aa2cddd6d725970945c97df89 (patch)
tree8d17685190e1c497d2f24495e38821b084386671 /libdw/dwarf_ranges.c
parent6f5934c1afa8f34bfb8f86b191ded9af854e757f (diff)
dwarf_ranges: do not request base address attributes if not necessary
- Instead of bailing out at iteration start, we remember the base-address-selecting attributes were not seen, and then bail out later if no base address selection entry has been seen. Signed-off-by: Petr Machata <[email protected]>
Diffstat (limited to 'libdw/dwarf_ranges.c')
-rw-r--r--libdw/dwarf_ranges.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c
index d9b7293d..4b6853d3 100644
--- a/libdw/dwarf_ranges.c
+++ b/libdw/dwarf_ranges.c
@@ -142,14 +142,7 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
DW_AT_entry_pc,
&attr_mem),
basep) != 0)
- {
- if (INTUSE(dwarf_errno) () == 0)
- {
- invalid:
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- }
- return -1;
- }
+ *basep = (Dwarf_Addr) -1;
}
else
{
@@ -182,7 +175,17 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
return -1l;
}
- /* We have an address range entry. */
+ /* We have an address range entry. Check that we have a base. */
+ if (*basep == (Dwarf_Addr) -1)
+ {
+ if (INTUSE(dwarf_errno) () == 0)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ }
+ return -1;
+ }
+
*startp = *basep + begin;
*endp = *basep + end;
return readp - (unsigned char *) d->d_buf;