This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] dwarf2read.c (create_addrmap_from_index): complain about bad CU index numbers
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 28 Mar 2013 17:19:52 -0700
- Subject: [commit] dwarf2read.c (create_addrmap_from_index): complain about bad CU index numbers
Hi.
This just adds some error checking.
Committed.
2013-03-28 Doug Evans <dje@google.com>
* dwarf2read.c (create_addrmap_from_index): Complain about bad CU
index numbers.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.762
diff -u -p -r1.762 dwarf2read.c
--- dwarf2read.c 29 Mar 2013 00:11:10 -0000 1.762
+++ dwarf2read.c 29 Mar 2013 00:13:34 -0000
@@ -2530,9 +2532,18 @@ create_addrmap_from_index (struct objfil
iter += 8;
cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE);
iter += 4;
-
- addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
- dw2_get_cu (cu_index));
+
+ if (cu_index < dwarf2_per_objfile->n_comp_units)
+ {
+ addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
+ dw2_get_cu (cu_index));
+ }
+ else
+ {
+ complaint (&symfile_complaints,
+ _(".gdb_index address table has invalid CU number %u"),
+ (unsigned) cu_index);
+ }
}
objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,