[PATCH] gdb: Fixed type in value.c
Lukas Durfina
ldurfina@tachyum.com
Wed Aug 5 09:31:00 GMT 2020
Type's length is ULONGEST. It fixes an issue with fortran arrays.
Instead of crash with the message:
internal-error: virtual memory exhausted: can't allocate 240518168752 bytes.
There is correct error message in backtrace:
str=<error reading variable: value requires 240518168752 bytes, which is more than max-value-size>
gdb/ChangeLog:
* value.c (check_type_length_before_alloc): Fixed type.
---
gdb/ChangeLog | 4 ++++
gdb/value.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2cd89b73b7d..0855255e536 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-05 Lukas Durfina <ldurfina@tachyum.com>
+
+ * value.c (check_type_length_before_alloc): Fixed type.
+
2020-08-04 Simon Marchi <simon.marchi@efficios.com>
* frame.h (frame_id_p): Return bool.
diff --git a/gdb/value.c b/gdb/value.c
index aac9baaaf56..65307d7631a 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -997,15 +997,15 @@ show_max_value_size (struct ui_file *file, int from_tty,
static void
check_type_length_before_alloc (const struct type *type)
{
- unsigned int length = TYPE_LENGTH (type);
+ ULONGEST length = TYPE_LENGTH (type);
if (max_value_size > -1 && length > max_value_size)
{
if (type->name () != NULL)
- error (_("value of type `%s' requires %u bytes, which is more "
+ error (_("value of type `%s' requires %lu bytes, which is more "
"than max-value-size"), type->name (), length);
else
- error (_("value requires %u bytes, which is more than "
+ error (_("value requires %lu bytes, which is more than "
"max-value-size"), length);
}
}
--
2.17.1
More information about the Gdb-patches
mailing list