NEWS: Mention new sim --map-info flag.
[deliverable/binutils-gdb.git] / gdb / c-valprint.c
index 521460b21fca98113ac5a3692f068b7c306c0973..20ac6336cd20f2a5a9fb9761f06b00bb8c700ec9 100644 (file)
@@ -171,8 +171,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       elttype = check_typedef (unresolved_elttype);
       if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
        {
+          LONGEST low_bound, high_bound;
+
+          if (!get_array_bounds (type, &low_bound, &high_bound))
+            error (_("Could not determine the array high bound"));
+
          eltlen = TYPE_LENGTH (elttype);
-         len = TYPE_LENGTH (type) / eltlen;
+         len = high_bound - low_bound + 1;
          if (options->prettyprint_arrays)
            {
              print_spaces_filtered (2 + 2 * recurse, stream);
@@ -289,7 +294,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
          if (c_textual_element_type (unresolved_elttype, options->format)
              && addr != 0)
            {
-             i = val_print_string (unresolved_elttype, addr, -1, stream,
+             i = val_print_string (unresolved_elttype, NULL, addr, -1, stream,
                                    options);
            }
          else if (cp_is_vtbl_member (type))
This page took 0.023082 seconds and 4 git commands to generate.