summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-01-26 18:36:16 -0800
committerRoland McGrath <roland@redhat.com>2009-01-26 18:36:16 -0800
commitf46272a1a9b79efd294465ebfb8d7da4a2220100 (patch)
tree034b3c85d7e9b5d1340666a12aef1a140d11ecb5
parentd31505f6a07b91b23d62f9acd37e38658e790543 (diff)
downloadelfutils-f46272a1a9b79efd294465ebfb8d7da4a2220100.tar.gz
dwarf_ranges.c: Return 0 when no ranges or *_pc attrs at all.
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_ranges.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 89225e93..0d94b45a 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-26 Roland McGrath <roland@redhat.com>
+
+ * dwarf_ranges.c: Return 0 when no ranges or *_pc attrs at all.
+
2009-01-25 Roland McGrath <roland@redhat.com>
* dwarf_getattrs.c: Correctly skip attribute values when restarting.
diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c
index 89da0af4..1eef617b 100644
--- a/libdw/dwarf_ranges.c
+++ b/libdw/dwarf_ranges.c
@@ -1,5 +1,5 @@
/* Enumerate the PC ranges covered by a DIE.
- Copyright (C) 2005, 2007 Red Hat, Inc.
+ Copyright (C) 2005, 2007, 2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -78,8 +78,9 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
/* We have to look for a noncontiguous range. */
const Elf_Data *d = die->cu->dbg->sectiondata[IDX_debug_ranges];
- if (d == NULL)
+ if (d == NULL && offset != 0)
{
+ no_ranges:
__libdw_seterrno (DWARF_E_NO_DEBUG_RANGES);
return -1;
}
@@ -90,13 +91,17 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_ranges,
&attr_mem);
if (attr == NULL)
- return -1;
+ /* No PC attributes in this DIE at all, so an empty range list. */
+ return 0;
/* Must have the form data4 or data8 which act as an offset. */
Dwarf_Word start_offset;
if (INTUSE(dwarf_formudata) (attr, &start_offset) != 0)
return -1;
+ if (d == NULL)
+ goto no_ranges;
+
offset = start_offset;
assert ((Dwarf_Word) offset == start_offset);