This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] gdb: New set/show max-value-size command.
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: brobecker at adacore dot com, gdb-patches at sourceware dot org
- Date: Tue, 05 Jan 2016 18:24:32 +0200
- Subject: Re: [PATCH 1/3] gdb: New set/show max-value-size command.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1449869721 dot git dot andrew dot burgess at embecosm dot com> <57e2731e179d11c584e8cde994ab1e822a9893b0 dot 1449869722 dot git dot andrew dot burgess at embecosm dot com> <20160101094309 dot GC12416 at adacore dot com> <20160105141241 dot GG4242 at embecosm dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Tue, 5 Jan 2016 14:12:41 +0000
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: gdb-patches@sourceware.org
>
> For languages with dynamic types, an incorrect program, or uninitialised
> variables within a program, could result in an incorrect, overly large
> type being associated with a value. Currently, attempting to print such
> a variable will result in gdb trying to allocate an overly large buffer.
>
> If this large memory allocation fails then the result can be gdb either
> terminating, or (due to memory contention) becoming unresponsive for the
> user.
>
> A new user visible variable in gdb helps guard against such problems,
> two new commands are available:
>
> set max-value-size
> show max-value-size
>
> The 'max-value-size' is the maximum size in bytes that gdb will allocate
> for the contents of a value. Any attempt to allocate a value with a
> size greater than this will result in an error. The initial default for
> this limit is set at 64k, this is based on a similar limit that exists
> within the ada specific code.
>
> It is possible for the user to set max-value-size to unlimited, in which
> case the old behaviour is restored.
Thanks.
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Value Sizes): New section, also add the new section
> to the menu.
The addition to the menu is probably in a different node, so it needs
a separate entry in the ChangeLog.
> +set max-value-size
> +show max-value-size
> + Control the maximum size, in bytes, that GDB will allocate for value
> + contents. Prevent incorrect programs from causing GDB to allocate
> + overly large buffers. Default is unlimited.
"Controls" and "Prevents". Also "maximum size of memory" (we allocate
memory, not size).
> +@table @code
> +@kindex set max-value-size
> +@itemx set max-value-size @var{bytes}
> +@itemx set max-value-size unlimited
> +Set the maximum size, in bytes, that @value{GDBN} will allocate for
Same here:
Set the maximum size of memory, in bytes, that @value{GDBN} will ...
Also, the "in bytes" part is redundant, since the parameter is called
"bytes", which is self-explanatory.
> +the contents of a value to @var{bytes}. Any value whose contents
> +require more than this number of bytes can't be displayed by
> +@value{GDBN}, and trying to display the value will result in an error.
I would remove the "can't be displayed by @value{GDBN}" part. It can
be interpreted to mean some limitation inherent in GDB, which is not
what you want to convey. The rest of the sentence says it all: trying
to display a value that requires more memory than that will result in
an error.
> +Setting this variable does not effect values that have already been
> +allocated within gdb, only future allocations.
^^^
@value{GDBN}
> +There's a minimum size that @code{max-value-size} can be set too in
^^^
"to"
OK with those fixed.
Thanks.