aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-03-16 20:51:23 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-03-16 20:51:23 +0000
commitbbb0eef6998678547990f792068fc5a8d3286fa9 (patch)
treed4ed4fd45c42d9ef1da99ed610577785fe22e167 /gdb
parentb8d088acc8f9fe81d5ecbcbbecc694ac0091cb5e (diff)
downloadgdb-bbb0eef6998678547990f792068fc5a8d3286fa9.zip
gdb-bbb0eef6998678547990f792068fc5a8d3286fa9.tar.gz
gdb-bbb0eef6998678547990f792068fc5a8d3286fa9.tar.bz2
gdb/
* dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED. * valarith.c (value_subscripted_rvalue): Suppress error if TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/dwarf2read.c6
-rw-r--r--gdb/valarith.c3
3 files changed, 15 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f44b021..ed02929 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Chandru <chandru@in.ibm.com>
+
+ * dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED.
+ * valarith.c (value_subscripted_rvalue): Suppress error if
+ TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
+
2010-03-16 Holger Hans Peter Freyther <zecke@selfish.org>
* linux-record.c (record_linux_msghdr): Remove unintended semicolons.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 563cb18..cbb7424 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6074,6 +6074,12 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
range_type = create_range_type (NULL, base_type, low, high);
+ /* Mark arrays with dynamic length at least as an array of unspecified
+ length. GDB could check the boundary but before it gets implemented at
+ least allow accessing the array elements. */
+ if (attr && attr->form == DW_FORM_block1)
+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
+
name = dwarf2_name (die, cu);
if (name)
TYPE_NAME (range_type) = name;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 9f91f4e..60f09a6 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -198,7 +198,8 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
struct value *v;
- if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
+ if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
+ && elt_offs >= TYPE_LENGTH (array_type)))
error (_("no such vector element"));
v = allocate_value (elt_type);