From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34332 invoked by alias); 5 Jan 2016 16:24:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 34120 invoked by uid 89); 5 Jan 2016 16:24:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:TLS1.2, interpreted, Prevents, H*r:sk:RSA_AES X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 05 Jan 2016 16:24:33 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGUPL-0000Yw-3G for gdb-patches@sourceware.org; Tue, 05 Jan 2016 11:24:31 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGUPK-0000Ys-W6; Tue, 05 Jan 2016 11:24:27 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3876 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aGUPK-00016v-9V; Tue, 05 Jan 2016 11:24:26 -0500 Date: Tue, 05 Jan 2016 16:24:00 -0000 Message-Id: <83a8ok570f.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess CC: brobecker@adacore.com, gdb-patches@sourceware.org In-reply-to: <20160105141241.GG4242@embecosm.com> (message from Andrew Burgess on Tue, 5 Jan 2016 14:12:41 +0000) Subject: Re: [PATCH 1/3] gdb: New set/show max-value-size command. Reply-to: Eli Zaretskii References: <57e2731e179d11c584e8cde994ab1e822a9893b0.1449869722.git.andrew.burgess@embecosm.com> <20160101094309.GC12416@adacore.com> <20160105141241.GG4242@embecosm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00056.txt.bz2 > Date: Tue, 5 Jan 2016 14:12:41 +0000 > From: Andrew Burgess > 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.