aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-10-16 10:08:19 +0200
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-12-10 09:53:46 +0000
commit28d2bfb9c3e519a3b7619bbe5d061ebe520750ef (patch)
tree6d5d3817360c2c2ae738248ea453e7b1d8b68031 /gdb/dwarf2read.c
parentc74088593761f7e839aa9a97728df146f3dfb3d6 (diff)
downloadgdb-28d2bfb9c3e519a3b7619bbe5d061ebe520750ef.zip
gdb-28d2bfb9c3e519a3b7619bbe5d061ebe520750ef.tar.gz
gdb-28d2bfb9c3e519a3b7619bbe5d061ebe520750ef.tar.bz2
gdb: Handle multiple base address in debug_ranges data.
It is possible to use multiple base addresses within a single address range series, within the .debug_ranges section. The following is a simplified example for 32-bit addresses: .section ".debug_ranges" .4byte 0xffffffff .4byte BASE_1 .4byte START_OFFSET_1 .4byte END_OFFSET_1 .4byte START_OFFSET_2 .4byte END_OFFSET_2 .4byte 0xffffffff .4byte BASE_2 .4byte START_OFFSET_3 .4byte END_OFFSET_3 .4byte 0 .4byte 0 In this example START/END 1 and 2 are relative to BASE_1, while START/END 3 are relative to BASE_2. Currently gdb does not correctly parse this DWARF, resulting in corrupted address range information. This commit fixes this issue, and adds a new test to cover this case. In order to support testing of this feature extensions were made to the testsuite dwarf assembler, additional functionality was added to the .debug_line generation function, and a new function for generating the .debug_ranges section was added. gdb/ChangeLog: * dwarf2read.c (dwarf2_ranges_read): Unify and fix base address reading code. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-ranges-base.c: New file. * gdb.dwarf2/dw2-ranges-base.exp: New file. * lib/dwarf.exp (namespace eval Dwarf): Add new variables to support additional line table, and debug ranges generation. (Dwarf::ranges): New function, generate .debug_ranges. (Dwarf::lines): Support generating simple line table programs. (Dwarf::assemble): Initialise new namespace variables.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 298757c..4881d72 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11894,7 +11894,6 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
int found_base;
unsigned int dummy;
const gdb_byte *buffer;
- CORE_ADDR marker;
int low_set;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
@@ -11913,18 +11912,6 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
}
buffer = dwarf2_per_objfile->ranges.buffer + offset;
- /* Read in the largest possible address. */
- marker = read_address (obfd, buffer, cu, &dummy);
- if ((marker & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- buffer += 2 * addr_size;
- offset += 2 * addr_size;
- found_base = 1;
- }
-
low_set = 0;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -11949,9 +11936,9 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
the base address. Check for a base address here. */
if ((range_beginning & mask) == mask)
{
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ /* If we found the largest possible address, then we already
+ have the base address in range_end. */
+ base = range_end;
found_base = 1;
continue;
}