public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] gdb: New set/show max-value-size command.
Date: Tue, 05 Jan 2016 16:24:00 -0000	[thread overview]
Message-ID: <83a8ok570f.fsf@gnu.org> (raw)
In-Reply-To: <20160105141241.GG4242@embecosm.com> (message from Andrew Burgess	on Tue, 5 Jan 2016 14:12:41 +0000)

> 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.

  parent reply	other threads:[~2016-01-05 16:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 21:38 [PATCH 0/2] Problems with gdb.mi/mi-vla-fortran.exp Andrew Burgess
2015-12-11 21:38 ` [PATCH 2/3] gdb: Set max-value-size before running tests Andrew Burgess
2016-01-01  9:48   ` Joel Brobecker
2016-01-01  9:53     ` Joel Brobecker
2016-01-05 14:14       ` Andrew Burgess
2015-12-11 21:38 ` [PATCH 3/3] gdb: Guard against undefined behaviour in mi-vla-fortran.exp Andrew Burgess
2016-01-01 11:08   ` Joel Brobecker
2016-01-05 14:15     ` Andrew Burgess
2015-12-11 21:38 ` [PATCH 1/3] gdb: New set/show max-value-size command Andrew Burgess
2016-01-01  9:43   ` Joel Brobecker
2016-01-05 14:12     ` Andrew Burgess
2016-01-05 15:55       ` Pedro Alves
2016-01-05 16:24       ` Eli Zaretskii [this message]
2016-01-06 11:41         ` Andrew Burgess
2016-01-20 10:59           ` PING: " Andrew Burgess
2016-01-20 11:23             ` Eli Zaretskii
2016-01-20 15:23             ` Andrew Burgess
2016-01-28 15:11               ` PING #2: " Andrew Burgess
2016-02-01  3:21                 ` Joel Brobecker
2016-02-13 21:40           ` [testsuite patch] testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp [Re: [PATCH 1/3] gdb: New set/show max-value-size command.] Jan Kratochvil
2016-02-14  0:51             ` Andrew Burgess
2016-02-14  8:20               ` [commit] " Jan Kratochvil
2016-02-14  4:38             ` Joel Brobecker
2016-01-01  7:34 ` [PATCH 0/2] Problems with gdb.mi/mi-vla-fortran.exp Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a8ok570f.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=andrew.burgess@embecosm.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).