summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2019-03-29 10:15:38 -0700
committerKeith Seitz <keiths@redhat.com>2019-03-29 10:15:38 -0700
commitcc1defb1dcb5f1ca23a82bca233a48ab2657de6c (patch)
treec9319b63cfd5d879cbd1c3102643554b54a9f8aa
parent2487ef07c28b961c6e2b8c51161f88f93b181d07 (diff)
downloadbinutils-gdb-cc1defb1dcb5f1ca23a82bca233a48ab2657de6c.tar.gz
Allow really large fortran array bounds: TYPE_LENGTH to ULONGEST
This series is revisit of Siddhesh Poyarekar's patch from back in 2012. The last status on the patch is in the following gdb-patches thread: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html It appears that Tom approved the patch, but Jan had some issues with a compiler error that made the test fail on -m32 test runs. He wrote up a hand-tweaked .S file to deal with it. Siddesh said he would update tests. Then nothing. Siddesh and Jan have both moved on since. The patch originally required a large precursor patch to work. I have whittled this down to/rewritten the bare minimum, and this first patch is the result, changing the type of TYPE_LENGTH to ULONGEST from unsigned int. The majority of the changes involve changing printf format strings to use %s and pulongest instead of %d. gdb/ChangeLog: * ada-lang.c (ada_template_to_fixed_record_type_1): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * ada-typerint.c (ada_print_type): Likewise. * amd64-windows-tdep.c (amd64_windows_store_arg_in_reg): Likewise. * compile/compile-c-support.c (generate_register_struct): Likewise. * gdbtypes.c (recursive_dump_type): Likewise. * gdbtypes.h (struct type) <length>: Change type to ULONGEST. * m2-typeprint.c (m2_array): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * riscv-tdep.c (riscv_type_alignment): Cast second argument to std::min to ULONGEST. * symmisc.c (print_symbol): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * tracepoint.c (info_scope_command): Likewise. * typeprint.c (print_offset_data::update) (print_offset_data::finish): Likewise. * xtensa-tdep.c (xtensa_store_return_value) (xtensa_push_dummy_call): Likewise.
-rw-r--r--gdb/ChangeLog22
-rw-r--r--gdb/ada-lang.c8
-rw-r--r--gdb/ada-typeprint.c7
-rw-r--r--gdb/amd64-windows-tdep.c2
-rw-r--r--gdb/compile/compile-c-support.c4
-rw-r--r--gdb/gdbtypes.c2
-rw-r--r--gdb/gdbtypes.h2
-rw-r--r--gdb/m2-typeprint.c6
-rw-r--r--gdb/riscv-tdep.c2
-rw-r--r--gdb/symmisc.c4
-rw-r--r--gdb/tracepoint.c7
-rw-r--r--gdb/typeprint.c7
-rw-r--r--gdb/xtensa-tdep.c8
13 files changed, 54 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0d1cb449578..71951b77640 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2019-03-29 Keith Seitz <keiths@redhat.com>
+
+ * ada-lang.c (ada_template_to_fixed_record_type_1): Use
+ %s/pulongest for TYPE_LENGTH instead of %d in format
+ strings.
+ * ada-typerint.c (ada_print_type): Likewise.
+ * amd64-windows-tdep.c (amd64_windows_store_arg_in_reg): Likewise.
+ * compile/compile-c-support.c (generate_register_struct): Likewise.
+ * gdbtypes.c (recursive_dump_type): Likewise.
+ * gdbtypes.h (struct type) <length>: Change type to ULONGEST.
+ * m2-typeprint.c (m2_array): Use %s/pulongest for TYPE_LENGTH
+ instead of %d in format strings.
+ * riscv-tdep.c (riscv_type_alignment): Cast second argument
+ to std::min to ULONGEST.
+ * symmisc.c (print_symbol): Use %s/pulongest for TYPE_LENGTH
+ instead of %d in format strings.
+ * tracepoint.c (info_scope_command): Likewise.
+ * typeprint.c (print_offset_data::update)
+ (print_offset_data::finish): Likewise.
+ * xtensa-tdep.c (xtensa_store_return_value)
+ (xtensa_push_dummy_call): Likewise.
+
2019-03-28 Jon Turney <jon.turney@dronecode.org.uk>
* windows-nat.c (display_selector): Fixed format specifications
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 692d52a9551..cdaf5589bc4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8500,11 +8500,11 @@ ada_template_to_fixed_record_type_1 (struct type *type,
if (TYPE_LENGTH (type) <= 0)
{
if (TYPE_NAME (rtype))
- warning (_("Invalid type size for `%s' detected: %d."),
- TYPE_NAME (rtype), TYPE_LENGTH (type));
+ warning (_("Invalid type size for `%s' detected: %s."),
+ TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type)));
else
- warning (_("Invalid type size for <unnamed> detected: %d."),
- TYPE_LENGTH (type));
+ warning (_("Invalid type size for <unnamed> detected: %s."),
+ pulongest (TYPE_LENGTH (type)));
}
else
{
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 8c42e8140de..efcd14bedc5 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -895,8 +895,8 @@ ada_print_type (struct type *type0, const char *varstring,
const char *name = ada_type_name (type);
if (!ada_is_range_type_name (name))
- fprintf_filtered (stream, _("<%d-byte integer>"),
- TYPE_LENGTH (type));
+ fprintf_filtered (stream, _("<%s-byte integer>"),
+ pulongest (TYPE_LENGTH (type)));
else
{
fprintf_filtered (stream, "range ");
@@ -917,7 +917,8 @@ ada_print_type (struct type *type0, const char *varstring,
}
break;
case TYPE_CODE_FLT:
- fprintf_filtered (stream, _("<%d-byte float>"), TYPE_LENGTH (type));
+ fprintf_filtered (stream, _("<%s-byte float>"),
+ pulongest (TYPE_LENGTH (type)));
break;
case TYPE_CODE_ENUM:
if (show < 0)
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 65c05c645ab..922da9e48bc 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -144,7 +144,7 @@ amd64_windows_store_arg_in_reg (struct regcache *regcache,
gdb_assert (TYPE_LENGTH (type) <= 8);
memset (buf, 0, sizeof buf);
- memcpy (buf, valbuf, std::min (TYPE_LENGTH (type), (unsigned int) 8));
+ memcpy (buf, valbuf, std::min (TYPE_LENGTH (type), (ULONGEST) 8));
regcache->cooked_write (regno, buf);
}
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 3d2913cd14c..d1947da6570 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -270,11 +270,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
default:
fprintf_unfiltered (stream,
- " unsigned char %s[%d]"
+ " unsigned char %s[%s]"
" __attribute__((__aligned__("
"__BIGGEST_ALIGNMENT__)))",
regname.c_str (),
- TYPE_LENGTH (regtype));
+ pulongest (TYPE_LENGTH (regtype)));
}
fputs_unfiltered (";\n", stream);
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 7a584172c5e..b1a51374d96 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4591,7 +4591,7 @@ recursive_dump_type (struct type *type, int spaces)
break;
}
puts_filtered ("\n");
- printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
+ printfi_filtered (spaces, "length %s\n", pulongest (TYPE_LENGTH (type)));
if (TYPE_OBJFILE_OWNED (type))
{
printfi_filtered (spaces, "objfile ");
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 66051cf02c7..2125ed991d0 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -859,7 +859,7 @@ struct type
type_length_units function should be used in order to get the length
expressed in target addressable memory units. */
- unsigned int length;
+ ULONGEST length;
/* * Core type, shared by a group of qualified types. */
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 754fb657afd..dae07d1c531 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -234,9 +234,9 @@ static void m2_array (struct type *type, struct ui_file *stream,
m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 1);
}
else
- fprintf_filtered (stream, "%d",
- (TYPE_LENGTH (type)
- / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
+ fputs_filtered (pulongest ((TYPE_LENGTH (type)
+ / TYPE_LENGTH (TYPE_TARGET_TYPE (type)))),
+ stream);
}
fprintf_filtered (stream, "] OF ");
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 8a996f32d39..ff5f36e7621 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1645,7 +1645,7 @@ riscv_type_alignment (struct type *t)
case TYPE_CODE_ARRAY:
if (TYPE_VECTOR (t))
- return std::min (TYPE_LENGTH (t), (unsigned) BIGGEST_ALIGNMENT);
+ return std::min (TYPE_LENGTH (t), (ULONGEST) BIGGEST_ALIGNMENT);
/* FALLTHROUGH */
case TYPE_CODE_COMPLEX:
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 5ff66bd6251..0220b42749e 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -583,8 +583,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
unsigned i;
struct type *type = check_typedef (SYMBOL_TYPE (symbol));
- fprintf_filtered (outfile, "const %u hex bytes:",
- TYPE_LENGTH (type));
+ fprintf_filtered (outfile, "const %s hex bytes:",
+ pulongest (TYPE_LENGTH (type)));
for (i = 0; i < TYPE_LENGTH (type); i++)
fprintf_filtered (outfile, " %02x",
(unsigned) SYMBOL_VALUE_BYTES (symbol)[i]);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 8cdda7aeed9..c7585c67839 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2636,8 +2636,11 @@ info_scope_command (const char *args_in, int from_tty)
}
}
if (SYMBOL_TYPE (sym))
- printf_filtered (", length %d.\n",
- TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))));
+ {
+ struct type *t = check_typedef (SYMBOL_TYPE (sym));
+
+ printf_filtered (", length %s.\n", pulongest (TYPE_LENGTH (t)));
+ }
}
if (BLOCK_FUNCTION (block))
break;
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 114725bc695..0a93a831b86 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -120,7 +120,8 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
{
/* Since union fields don't have the concept of offsets, we just
print their sizes. */
- fprintf_filtered (stream, "/* %4u */", TYPE_LENGTH (ftype));
+ fprintf_filtered (stream, "/* %4s */",
+ pulongest (TYPE_LENGTH (ftype)));
return;
}
@@ -183,8 +184,8 @@ print_offset_data::finish (struct type *type, int level,
fputs_filtered ("\n", stream);
print_spaces_filtered (level + 4 + print_offset_data::indentation, stream);
- fprintf_filtered (stream, "/* total size (bytes): %4u */\n",
- TYPE_LENGTH (type));
+ fprintf_filtered (stream, "/* total size (bytes): %4s */\n",
+ pulongest (TYPE_LENGTH (type)));
}
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index fcec9961ee3..efa0bcb1dc3 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1615,8 +1615,8 @@ xtensa_store_return_value (struct type *type,
if (len > (callsize > 8 ? 8 : 16))
internal_error (__FILE__, __LINE__,
- _("unimplemented for this length: %d"),
- TYPE_LENGTH (type));
+ _("unimplemented for this length: %s"),
+ pulongest (TYPE_LENGTH (type)));
areg = arreg_number (gdbarch,
gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
@@ -1723,9 +1723,9 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
{
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
- fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i,
+ fprintf_unfiltered (gdb_stdlog, "%2d: %s %3s ", i,
host_address_to_string (arg),
- TYPE_LENGTH (arg_type));
+ pulongest (TYPE_LENGTH (arg_type)));
switch (TYPE_CODE (arg_type))
{
case TYPE_CODE_INT: