* p-valprint.c (pascal_val_print): Call get_array_bounds
authorPierre Muller <muller@sourceware.org>
Thu, 20 May 2010 07:41:40 +0000 (07:41 +0000)
committerPierre Muller <muller@sourceware.org>
Thu, 20 May 2010 07:41:40 +0000 (07:41 +0000)
to obtain the number of elements in an array.

gdb/ChangeLog
gdb/p-valprint.c

index 5cba88b8c5569cef0250e1d8b6f781676eab48d7..9828c3ae67c6bbe99555c3357500848424a79d51 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-20  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+       * p-valprint.c (pascal_val_print): Call get_array_bounds
+       to obtain the number of elements in an array.
+
 2010-05-19  Doug Evans  <dje@google.com>
 
        * python.c (gdbpy_print_stack): Ensure output ends with a newline.
index 5f495b5d2bce7e7549f52735bf27e8dd45597770..1c2f36d51bb29924f5397b16c3d5ef5cdfc21de8 100644 (file)
@@ -60,6 +60,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int i = 0;  /* Number of characters printed */
   unsigned len;
+  long low_bound, high_bound;
   struct type *elttype;
   unsigned eltlen;
   int length_pos, length_size, string_pos;
@@ -71,11 +72,11 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_ARRAY:
-      if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
+      if (get_array_bounds (type, &low_bound, &high_bound)) 
        {
+         len = high_bound - low_bound + 1;
          elttype = check_typedef (TYPE_TARGET_TYPE (type));
          eltlen = TYPE_LENGTH (elttype);
-         len = TYPE_LENGTH (type) / eltlen;
          if (options->prettyprint_arrays)
            {
              print_spaces_filtered (2 + 2 * recurse, stream);
This page took 0.032321 seconds and 4 git commands to generate.