From patchwork Fri Feb 10 15:55:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Galvan X-Patchwork-Id: 19214 Received: (qmail 130337 invoked by alias); 10 Feb 2017 15:56:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 130314 invoked by uid 89); 10 Feb 2017 15:56:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:a969d1b, @dots, dots, surrounded X-HELO: mail-qt0-f181.google.com Received: from mail-qt0-f181.google.com (HELO mail-qt0-f181.google.com) (209.85.216.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Feb 2017 15:56:13 +0000 Received: by mail-qt0-f181.google.com with SMTP id w20so38262073qtb.1 for ; Fri, 10 Feb 2017 07:56:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=PrcNIztaynPLXkfYHS3F0KoIdqE3I5SeFcqR5X1er3o=; b=oZLTJQv2B7ORxqijssPKwNXc+1Pc0zsWQbGmQHu1/q4gL3yJHrD6GXEnw9MFXJdy69 7Y+px8XdDx2kJhrFpYLuc/cobG2rzXAWvR5ZXSvyTRbz8PU3mjGhe+awCixn0y4BIJaO appNbcthDO9gdQDLiP2RJiGEhndblfaIYt1WVDFbud7KmO6xJjsfTmJFfkyGviMqfzf+ 0c+VfpokrRb+i2s7hRlAG7F0iHOiPbNipF7uth9ZEgcZPpDfWQL5JtD9TlpjfMZcC7uP BMQduhj8PLr8SIAkBsZ2Yn7yhvZK8l3Eb8sTc+fF0Y77fALFGbhH20OSa7gQYc2F1Y55 7X3A== X-Gm-Message-State: AMke39mW3LvQSfAvK9WMuQgnu3yZL/3eyCzNRU5yktBf6Azi/IWF9p12iRYwTF8aliGJCw== X-Received: by 10.200.53.145 with SMTP id k17mr8458868qtb.47.1486742171625; Fri, 10 Feb 2017 07:56:11 -0800 (PST) Received: from martin-galvan.windriver.org ([190.123.122.250]) by smtp.gmail.com with ESMTPSA id h184sm121790qkf.68.2017.02.10.07.56.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Feb 2017 07:56:11 -0800 (PST) From: Martin Galvan To: gdb-patches@sourceware.org, palves@redhat.com, eliz@gnu.org, daniel.gutson@gmail.com Subject: [PATCH] PR gdb/21122: Fix documentation mistakes for breakpoint commands Date: Fri, 10 Feb 2017 12:55:56 -0300 Message-Id: <1486742156-21633-1-git-send-email-omgalvan.86@gmail.com> Currently, the breakpoint documentation refers to some commands taking breakpoint "ranges" as arguments. We discussed this with Pedro and concluded that it would be more accurate to speak in terms of breakpoint "lists", whose elements can optionally be ranges. I also fixed a couple of minor mistakes in the docs. Ok to commit? gdb/ChangeLog: 2017-02-10 Martin Galvan * breakpoint.c (_initialize_breakpoint): Update the help description of the 'commands' command to indicate that it takes a list argument. gdb/doc/ChangeLog: * gdb.texinfo (Breakpoints): Reword documentation to speak in terms of space-separated breakpoint lists. Also add a missing @table command and @cindex for breakpoint lists. gdb/testsuite/ChangeLog: * gdb.base/help.exp: Update match pattern for testing 'help commands'. --- gdb/breakpoint.c | 6 ++++-- gdb/doc/gdb.texinfo | 40 ++++++++++++++++++++++------------------ gdb/testsuite/gdb.base/help.exp | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a76b3e4..ab6e9c8 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -16165,8 +16165,10 @@ Set ignore-count of breakpoint number N to COUNT.\n\ Usage is `ignore N COUNT'.")); add_com ("commands", class_breakpoint, commands_command, _("\ -Set commands to be executed when a breakpoint is hit.\n\ -Give breakpoint number as argument after \"commands\".\n\ +Set commands to be executed when the given breakpoints are hit.\n\ +Give a space-separated breakpoint list as argument after \"commands\".\n\ +A list element can be a breakpoint number (e.g. `5') or a range of numbers\n\ +(e.g. `5-7').\n\ With no argument, the targeted breakpoint is the last one set.\n\ The commands themselves follow starting on the next line.\n\ Type a line containing \"end\" to indicate the end of them.\n\ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a969d1b..35804c1 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3588,12 +3588,14 @@ breakpoint you want to change. Each breakpoint may be @dfn{enabled} or enable it again. @cindex breakpoint ranges +@cindex breakpoint lists @cindex ranges of breakpoints -Some @value{GDBN} commands accept a range of breakpoints on which to -operate. A breakpoint range is either a single breakpoint number, like -@samp{5}, or two such numbers, in increasing order, separated by a -hyphen, like @samp{5-7}. When a breakpoint range is given to a command, -all breakpoints in that range are operated on. +@cindex lists of breakpoints +Some @value{GDBN} commands accept a space-separated list of breakpoints +on which to operate. A list element can be either a single breakpoint number, +like @samp{5}, or a range of such numbers, like @samp{5-7}. +When a breakpoint list is given to a command, all breakpoints in that list +are operated on. @menu * Set Breaks:: Setting breakpoints @@ -3758,8 +3760,8 @@ optionally be surrounded by spaces. @kindex info breakpoints @cindex @code{$_} and @code{info breakpoints} -@item info breakpoints @r{[}@var{n}@dots{}@r{]} -@itemx info break @r{[}@var{n}@dots{}@r{]} +@item info breakpoints @r{[}@var{list}@dots{}@r{]} +@itemx info break @r{[}@var{list}@dots{}@r{]} Print a table of all breakpoints, watchpoints, and catchpoints set and not deleted. Optional argument @var{n} means print information only about the specified breakpoint(s) (or watchpoint(s) or catchpoint(s)). @@ -3947,7 +3949,7 @@ breakpoints set by commands like @code{next} and @code{finish}. For breakpoints set with @code{hbreak}, @value{GDBN} will always use hardware breakpoints. -You can control this automatic behaviour with the following commands:: +You can control this automatic behaviour with the following commands: @kindex set breakpoint auto-hw @kindex show breakpoint auto-hw @@ -4142,8 +4144,8 @@ by the program. Set a watchpoint that will break when @var{expr} is either read from or written into by the program. -@kindex info watchpoints @r{[}@var{n}@dots{}@r{]} -@item info watchpoints @r{[}@var{n}@dots{}@r{]} +@kindex info watchpoints @r{[}@var{list}@dots{}@r{]} +@item info watchpoints @r{[}@var{list}@dots{}@r{]} This command prints a list of watchpoints, using the same format as @code{info break} (@pxref{Set Breaks}). @end table @@ -4639,9 +4641,9 @@ Delete any breakpoints set at or within the code of the specified @cindex delete breakpoints @kindex delete @kindex d @r{(@code{delete})} -@item delete @r{[}breakpoints@r{]} @r{[}@var{range}@dots{}@r{]} +@item delete @r{[}breakpoints@r{]} @r{[}@var{list}@dots{}@r{]} Delete the breakpoints, watchpoints, or catchpoints of the breakpoint -ranges specified as arguments. If no argument is specified, delete all +list specified as argument. If no argument is specified, delete all breakpoints (@value{GDBN} asks confirmation, unless you have @code{set confirm off}). You can abbreviate this command as @code{d}. @end table @@ -4691,7 +4693,7 @@ watchpoints, and catchpoints: @table @code @kindex disable @kindex dis @r{(@code{disable})} -@item disable @r{[}breakpoints@r{]} @r{[}@var{range}@dots{}@r{]} +@item disable @r{[}breakpoints@r{]} @r{[}@var{list}@dots{}@r{]} Disable the specified breakpoints---or all breakpoints, if none are listed. A disabled breakpoint has no effect but is not forgotten. All options such as ignore-counts, conditions and commands are remembered in @@ -4699,15 +4701,15 @@ case the breakpoint is enabled again later. You may abbreviate @code{disable} as @code{dis}. @kindex enable -@item enable @r{[}breakpoints@r{]} @r{[}@var{range}@dots{}@r{]} +@item enable @r{[}breakpoints@r{]} @r{[}@var{list}@dots{}@r{]} Enable the specified breakpoints (or all defined breakpoints). They become effective once again in stopping your program. -@item enable @r{[}breakpoints@r{]} once @var{range}@dots{} +@item enable @r{[}breakpoints@r{]} once @var{list}@dots{} Enable the specified breakpoints temporarily. @value{GDBN} disables any of these breakpoints immediately after stopping your program. -@item enable @r{[}breakpoints@r{]} count @var{count} @var{range}@dots{} +@item enable @r{[}breakpoints@r{]} count @var{count} @var{list}@dots{} Enable the specified breakpoints temporarily. @value{GDBN} records @var{count} with each of the specified breakpoints, and decrements a breakpoint's count when it is hit. When any count reaches 0, @@ -4715,7 +4717,7 @@ breakpoint's count when it is hit. When any count reaches 0, count (@pxref{Conditions, ,Break Conditions}), that will be decremented to 0 before @var{count} is affected. -@item enable @r{[}breakpoints@r{]} delete @var{range}@dots{} +@item enable @r{[}breakpoints@r{]} delete @var{list}@dots{} Enable the specified breakpoints to work once, then die. @value{GDBN} deletes any of these breakpoints as soon as your program stops there. Breakpoints set by the @code{tbreak} command start out in this state. @@ -4873,7 +4875,7 @@ enable other breakpoints. @table @code @kindex commands @kindex end@r{ (breakpoint commands)} -@item commands @r{[}@var{range}@dots{}@r{]} +@item commands @r{[}@var{list}@dots{}@r{]} @itemx @dots{} @var{command-list} @dots{} @itemx end Specify a list of commands for the given breakpoints. The commands @@ -4986,6 +4988,7 @@ dynamic printfs immediately. (If you need individual control over the print commands, simply define normal breakpoints with explicitly-supplied command lists.) +@table @code @item gdb @kindex dprintf-style gdb Handle the output using the @value{GDBN} @code{printf} command. @@ -5000,6 +5003,7 @@ Handle the output by calling a function in your program (normally Have the remote debugging agent (such as @code{gdbserver}) handle the output itself. This style is only available for agents that support running commands on the target. +@end table @item set dprintf-function @var{function} Set the function to call if the dprintf style is @code{call}. By diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index 0043642..58f4b5d 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -78,7 +78,7 @@ gdb_test "help bt" $help_backtrace_text "help backtrace \"bt\" abbreviation" gdb_test "help backtrace" $help_backtrace_text "help backtrace" # test help commands -gdb_test "help commands" "Set commands to be executed when a breakpoint is hit\.\[\r\n\]+Give breakpoint number as argument after \"commands\"\.\[\r\n\]+With no argument, the targeted breakpoint is the last one set\.\[\r\n\]+The commands themselves follow starting on the next line\.\[\r\n\]+Type a line containing \"end\" to indicate the end of them\.\[\r\n\]+Give \"silent\" as the first line to make the breakpoint silent;\[\r\n\]+then no output is printed when it is hit, except what the commands print\." "help commands" +gdb_test "help commands" "Set commands to be executed when the given breakpoints are hit\.\[\r\n\]+Give a space-separated breakpoint list as argument after \"commands\"\.\[\r\n\]+A list element can be a breakpoint number \\(e.g. `5'\\) or a range of numbers\[\r\n\]+\\(e.g. `5-7'\\)\.\[\r\n\]+With no argument, the targeted breakpoint is the last one set\.\[\r\n\]+The commands themselves follow starting on the next line\.\[\r\n\]+Type a line containing \"end\" to indicate the end of them\.\[\r\n\]+Give \"silent\" as the first line to make the breakpoint silent;\[\r\n\]+then no output is printed when it is hit, except what the commands print\." "help commands" # Test a prefix command. "delete" is picked at random. # test help delete "d" abbreviation