gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 16 Mar 2010 20:51:23 +0000 (20:51 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 16 Mar 2010 20:51:23 +0000 (20:51 +0000)
* dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED.
* valarith.c (value_subscripted_rvalue): Suppress error if
TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/valarith.c

index f44b0218dedfd2e5c651410eb653f69920c37db3..ed029296ab8f78dee8b18a05c602eb1aca871597 100644 (file)
@@ -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.
index 563cb185de64e85d4092cd6057a90b26b8a08f30..cbb742490f3f0c36d494ed52e98e00db768e20d7 100644 (file)
@@ -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;
index 9f91f4e0f0e8bbc1745d41b08325f6a4283b23c0..60f09a610e57d3a34bacc1440543b6e4eb0577ad 100644 (file)
@@ -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);
This page took 0.03549 seconds and 4 git commands to generate.