aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2013-03-29 00:18:32 +0000
committerDoug Evans <dje@google.com>2013-03-29 00:18:32 +0000
commitf652bce2eecba0f090550c462a356a65a379fada (patch)
tree264724b6f72ea8892e0e7b162a5f5dba742a351f
parente4a48d9d49e3d63b7d2f5d58bdb04e8ad3a4f2db (diff)
downloadgdb-f652bce2eecba0f090550c462a356a65a379fada.zip
gdb-f652bce2eecba0f090550c462a356a65a379fada.tar.gz
gdb-f652bce2eecba0f090550c462a356a65a379fada.tar.bz2
* dwarf2read.c (create_addrmap_from_index): Complain about bad CU
index numbers.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/dwarf2read.c15
2 files changed, 15 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 043093e..2838b3c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2013-03-28 Doug Evans <dje@google.com>
+ * dwarf2read.c (create_addrmap_from_index): Complain about bad CU
+ index numbers.
+
* dwarf2read.c (dw2_get_file_names): Delete arg "objfile".
All callers updated.
(dw2_print_stats): Print #read CUs too.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 2062448..a3e68cd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2530,9 +2530,18 @@ create_addrmap_from_index (struct objfile *objfile, struct mapped_index *index)
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,