This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] dwarf2read.c: ignore bad address ranges in .gdb_index
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 09 Aug 2013 10:29:06 -0700
- Subject: [commit] dwarf2read.c: ignore bad address ranges in .gdb_index
Hi.
I was seeing some bad address ranges in .gdb_index generated by Gold.
Regression tested on amd64-linux and committed.
2013-08-09 Doug Evans <dje@google.com>
* dwarf2read.c (create_addrmap_from_index): Ignore bad address table
entries.
diff -u -p -r1.824 dwarf2read.c
--- dwarf2read.c 7 Aug 2013 20:10:36 -0000 1.824
+++ dwarf2read.c 9 Aug 2013 17:26:09 -0000
@@ -2570,17 +2570,24 @@ create_addrmap_from_index (struct objfil
cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE);
iter += 4;
- if (cu_index < dwarf2_per_objfile->n_comp_units)
+ if (lo > hi)
{
- addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
- dw2_get_cu (cu_index));
+ complaint (&symfile_complaints,
+ _(".gdb_index address table has invalid range (%s - %s)"),
+ pulongest (lo), pulongest (hi));
+ continue;
}
- else
+
+ if (cu_index >= dwarf2_per_objfile->n_comp_units)
{
complaint (&symfile_complaints,
_(".gdb_index address table has invalid CU number %u"),
(unsigned) cu_index);
+ continue;
}
+
+ addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
+ dw2_get_cu (cu_index));
}
objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,