aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-07-19 16:35:48 +0000
committerDoug Evans <dje@google.com>2012-07-19 16:35:48 +0000
commit0109304504e0b6d611e95fc9c1e7bccdd64a0fee (patch)
tree92b9de3856b28a5d8e0e0478a6bc10d9347eb013
parenta7c3d162281ed09f37e48c486f74885d2f1e61fc (diff)
downloadgdb-0109304504e0b6d611e95fc9c1e7bccdd64a0fee.zip
gdb-0109304504e0b6d611e95fc9c1e7bccdd64a0fee.tar.gz
gdb-0109304504e0b6d611e95fc9c1e7bccdd64a0fee.tar.bz2
* dwarf2read.c (dwarf2_ranges_read): Ignore ranges starting at zero if
there's no section at address zero. (dwarf2_record_block_ranges): Ditto.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c28
2 files changed, 31 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 95187f8..0032aac 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-19 Doug Evans <dje@google.com>
+
+ * dwarf2read.c (dwarf2_ranges_read): Ignore ranges starting at zero if
+ there's no section at address zero.
+ (dwarf2_record_block_ranges): Ditto.
+
2012-07-19 Yao Qi <yao@codesourcery.com>
* command.h, remote.c: Fix a typo in comment.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 3aa5eef..8868540 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9284,6 +9284,17 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
range_beginning += base;
range_end += base;
+ /* A not-uncommon case of bad debug info.
+ Don't pollute the addrmap with bad data. */
+ if (range_beginning + baseaddr == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ complaint (&symfile_complaints,
+ _(".debug_ranges entry has start address of zero"
+ " [in module %s]"), objfile->name);
+ continue;
+ }
+
if (ranges_pst != NULL)
addrmap_set_empty (objfile->psymtabs_addrmap,
range_beginning + baseaddr,
@@ -9599,9 +9610,20 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
if (start == end)
continue;
- record_block_range (block,
- baseaddr + base + start,
- baseaddr + base + end - 1);
+ start += base + baseaddr;
+ end += base + baseaddr;
+
+ /* A not-uncommon case of bad debug info.
+ Don't pollute the addrmap with bad data. */
+ if (start == 0 && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ complaint (&symfile_complaints,
+ _(".debug_ranges entry has start address of zero"
+ " [in module %s]"), objfile->name);
+ continue;
+ }
+
+ record_block_range (block, start, end - 1);
}
}
}