From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6127 invoked by alias); 18 Jun 2019 16:42:28 -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 6119 invoked by uid 89); 18 Jun 2019 16:42:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jun 2019 16:42:26 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hdHBg-0003mb-Dp; Tue, 18 Jun 2019 12:42:24 -0400 Received: from [176.228.60.248] (port=3085 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hdHBf-00041v-6w; Tue, 18 Jun 2019 12:42:23 -0400 Date: Tue, 18 Jun 2019 16:42:00 -0000 Message-Id: <83sgs6sv44.fsf@gnu.org> From: Eli Zaretskii To: Pedro Alves CC: gdb-patches@sourceware.org, philippe.waroquiers@skynet.be In-reply-to: <20190618003902.19805-5-palves@redhat.com> (message from Pedro Alves on Tue, 18 Jun 2019 01:39:02 +0100) Subject: Re: [PATCH v2 4/4] Introduce the "with" command References: <20190618003902.19805-1-palves@redhat.com> <20190618003902.19805-5-palves@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00348.txt.bz2 > From: Pedro Alves > Cc: Philippe Waroquiers > Date: Tue, 18 Jun 2019 01:39:02 +0100 > > +@cindex change default behavior of commands > +@cindex change default settings Two index entries that start with the same text and point to the same place are not useful. I'd drop the second one. > +Many commands change their behavior according to command-specific > +variables or settings. These settings can be changed with the > +@code{set} subcommands. For example, the @code{print} command > +(@pxref{Data, ,Examining Data}) prints arrays differently depending on > +settings changeable with the commands @code{set print elements > +NUMBER-OF-ELEMENTS} and @code{set print array-indexes}, among others. > + > +You can set these settings to your preference in the gdbinit files > +loaded at @value{GDBN} startup. @xref{Startup}. > + > +The settings can also be changed interactively during the debugging > +session. For example, to change the limit of array elements to print, > +you can do the following: > +@smallexample > +(@value{GDBN}) set print elements 10 > +(@value{GDBN}) print some_array > +$1 = @{0, 10, 20, 30, 40, 50, 60, 70, 80, 90...@} > +@end smallexample > + > +The above @code{set print elements 10} command changes the number of > +elements to print from the default of 200 to 10. If you only intend > +this limit of 10 to be used for printing @code{some_array}, then you > +must restore the limit back to 200, with @code{set print elements > +200}. > + > +Some commands allow overriding settings with command options. For > +example, the @code{print} command supports a number of options that > +allow overriding relevant global print settings as set by @code{set > +print} subcommands. @xref{print options}. The example above could be > +rewritten as: > +@smallexample > +(@value{GDBN}) print -elements 10 -- some_array > +$1 = @{0, 10, 20, 30, 40, 50, 60, 70, 80, 90...@} > +@end smallexample > + > +Alternatively, you can use the @code{with} command to change a setting > +temporarily, for the duration of a command invocation. > + > +@table @code > +@kindex with command > +@kindex w @r{(@code{with})} > +@cindex settings > +@cindex temporarily change settings > +@item with @var{setting} [@var{value}] [-- @var{command}] > +@itemx w @var{setting} [@var{value}] [-- @var{command}] > +Temporarily set @var{setting} to @var{value} for the duration of > +@var{command}. > + > +If no @var{command} is provided, the last command executed is > +repeated. > + > +@var{setting} is any setting settable with the @code{set} subcommands. > + > +For example, the command > +@smallexample > +(@value{GDBN}) with print array on -- print some_array > +@end smallexample > +@noindent > +is equivalent to the following 3 commands: > +@smallexample > +(@value{GDBN}) set print array on > +(@value{GDBN}) print some_array > +(@value{GDBN}) set print array off > +@end smallexample > + > +The @code{with} command is particularly useful when you want to > +override a setting while running user-defined commands, or commands > +defined in Python or Guile. @xref{Extending GDB,, Extending GDB}. > + > +@smallexample > +(@value{GDBN}) with print pretty on -- my_complex_command > +@end smallexample > + > +To change several settings for the same command, you can nest > +@code{with} commands. For example, @code{with language ada -- with > +print elements 10} temporarily changes the language to Ada and sets a > +limit of 10 elements to print for arrays and strings. > + > +@end table This text is OK, but it keeps absolute silence regarding the "--" delimiter. It should explain why it is used here and how to use it with multiple "with" prefixes. > + SETTING is any GDB setting settable with the "set" command. "SETTING ... setting settable ... set". How about rewording to use the root "set" slightly fewer times? The documentation parts are OK with these nits fixed. Thanks.