[PATCH] gdb: Fixed type in value.c
Aktemur, Tankut Baris
tankut.baris.aktemur@intel.com
Wed Aug 5 09:56:48 GMT 2020
On August 5, 2020 11:31 AM, Lukas Durfina wrote:
> 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);
In both branches, instead of "%lu", one needs to use "%s" and wrap the argument in
pulongest. Like this:
error (_("value requires %s bytes, which is more than "
"max-value-size"), pulongest (length));
Thanks.
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list