diff options
author | Doug Evans <dje@google.com> | 2012-06-28 01:10:38 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-06-28 01:10:38 +0000 |
commit | 2e3cf129e630bec707b68e85b388b056ba3bbda2 (patch) | |
tree | a930a9ceb9ea41941530aa5d08d70a4de497d54e /gdb/dwarf2read.c | |
parent | d26281a3fcd12b3d1c21423c664f53f2f36f8a14 (diff) | |
download | gdb-2e3cf129e630bec707b68e85b388b056ba3bbda2.zip gdb-2e3cf129e630bec707b68e85b388b056ba3bbda2.tar.gz gdb-2e3cf129e630bec707b68e85b388b056ba3bbda2.tar.bz2 |
* dwarf2read.c (dwarf2_cu): Add ranges_base.
Delete have_addr_base, unused. All uses updated.
(init_cutu_and_read_dies): Process DW_AT_GNU_ranges_base.
(dwarf2_get_pc_bounds): Add ranges_base.
(dwarf2_record_block_ranges): Ditto.
testsuite/
* gdb.dwarf2/fission-base.c: New file.
* gdb.dwarf2/fission-base.S: New file.
* gdb.dwarf2/fission-base.exp: New file.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4b43adf..4744107 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -459,6 +459,13 @@ struct dwarf2_cu Note this value comes from the stub CU/TU's DIE. */ ULONGEST addr_base; + /* The DW_AT_ranges_base attribute if present, zero otherwise + (zero is a valid value though). + Note this value comes from the stub CU/TU's DIE. + Also note that the value is zero in the non-DWO case so this value can + be used without needing to know whether DWO files are in use or not. */ + ULONGEST ranges_base; + /* Mark used when releasing cached dies. */ unsigned int mark : 1; @@ -475,10 +482,6 @@ struct dwarf2_cu unsigned int checked_producer : 1; unsigned int producer_is_gxx_lt_4_6 : 1; unsigned int producer_is_icc : 1; - - /* Non-zero if DW_AT_addr_base was found. - Used when processing DWO files. */ - unsigned int have_addr_base : 1; }; /* Persistent data held for a compilation unit, even when not @@ -3996,13 +3999,16 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu, /* There should be a DW_AT_addr_base attribute here (if needed). We need the value before we can process DW_FORM_GNU_addr_index. */ cu->addr_base = 0; - cu->have_addr_base = 0; attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_addr_base, cu); if (attr) - { - cu->addr_base = DW_UNSND (attr); - cu->have_addr_base = 1; - } + cu->addr_base = DW_UNSND (attr); + + /* There should be a DW_AT_ranges_base attribute here (if needed). + We need the value before we can process DW_AT_ranges. */ + cu->ranges_base = 0; + attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_ranges_base, cu); + if (attr) + cu->ranges_base = DW_UNSND (attr); if (this_cu->is_debug_types) { @@ -8249,9 +8255,11 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, attr = dwarf2_attr (die, DW_AT_ranges, cu); if (attr != NULL) { + unsigned int ranges_offset = DW_UNSND (attr) + cu->ranges_base; + /* Value of the DW_AT_ranges attribute is the offset in the .debug_ranges section. */ - if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu, pst)) + if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst)) return 0; /* Found discontinuous range of addresses. */ ret = -1; @@ -8411,7 +8419,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, /* The value of the DW_AT_ranges attribute is the offset of the address range list in the .debug_ranges section. */ - unsigned long offset = DW_UNSND (attr); + unsigned long offset = DW_UNSND (attr) + cu->ranges_base; gdb_byte *buffer = dwarf2_per_objfile->ranges.buffer + offset; /* For some target architectures, but not others, the |