aboutsummaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.cc
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2012-05-01 19:12:21 +0000
committerMark Wielaard <mjw@redhat.com>2012-05-01 19:12:21 +0000
commit57923f48a1e2e9129fdb3dd536b38e8d1cd46089 (patch)
tree96aef3be136a701f422e7ddb4ab49a993af8b660 /gold/dwarf_reader.cc
parent57402f1e314550ef28cc63b16d5ac69270c02984 (diff)
downloadgdb-57923f48a1e2e9129fdb3dd536b38e8d1cd46089.zip
gdb-57923f48a1e2e9129fdb3dd536b38e8d1cd46089.tar.gz
gdb-57923f48a1e2e9129fdb3dd536b38e8d1cd46089.tar.bz2
gold: Handle DW_AT_high_pc as offset from DW_AT_low_pc in gdb-index.cc.
* dwarf_reader.cc (Dwarf_die::address_attribute): New function. * dwarf_reader.h (Dwarf_die::address_attribute): Likewise. * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle DW_AT_high_pc as offset from DW_AT_low_pc. * testsuite/Makefile.am (gdb_index_test_3.sh): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/gdb_index_test_3.c: New test source file. * testsuite/gdb_index_test_3.sh: New test source file.
Diffstat (limited to 'gold/dwarf_reader.cc')
-rw-r--r--gold/dwarf_reader.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc
index eaf35bf..6245dc8 100644
--- a/gold/dwarf_reader.cc
+++ b/gold/dwarf_reader.cc
@@ -1051,6 +1051,17 @@ Dwarf_die::ref_attribute(unsigned int attr, unsigned int* shndx)
}
}
+off_t
+Dwarf_die::address_attribute(unsigned int attr, unsigned int* shndx)
+{
+ const Attribute_value* attr_val = this->attribute(attr);
+ if (attr_val == NULL || attr_val->form != elfcpp::DW_FORM_addr)
+ return -1;
+
+ *shndx = attr_val->aux.shndx;
+ return attr_val->val.refval;
+}
+
// Return the offset of this DIE's first child.
off_t