From patchwork Fri Apr 26 20:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 32434 Received: (qmail 113199 invoked by alias); 26 Apr 2019 20:11:30 -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 113123 invoked by uid 89); 26 Apr 2019 20:11:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=2714, 377, Logging, HContent-Transfer-Encoding:8bit X-HELO: mailsec108.isp.belgacom.be Received: from mailsec108.isp.belgacom.be (HELO mailsec108.isp.belgacom.be) (195.238.20.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Apr 2019 20:11:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1556309487; x=1587845487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tDhLflT7HrFGBgX3Ta4GPlOWeLJnVPIiUgsbkFvkqw0=; b=p4VUSV+06oiroLhWIHyYspsAExc1+dQ1/5/Cn2FabxceiKlh8SVWNDyp 4La+k3fgjuHWWnsHWctNMHps6mAfBg==; Received: from 59.151-129-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.129.151.59]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 26 Apr 2019 22:11:14 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 6/6] NEWS and documentation for | (pipe) command. Date: Fri, 26 Apr 2019 22:11:08 +0200 Message-Id: <20190426201108.7489-7-philippe.waroquiers@skynet.be> In-Reply-To: <20190426201108.7489-1-philippe.waroquiers@skynet.be> References: <20190426201108.7489-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/ChangeLog * NEWS: Mention new pipe command. gdb/doc/ChangeLog * gdb.texinfo (Shell Commands): Document pipe command. (Logging Output): Add a reference to pipe command. --- gdb/NEWS | 8 ++++++++ gdb/doc/gdb.texinfo | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 5309a8f923..8744659e7b 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -27,6 +27,14 @@ 'array_indexes', 'symbols', 'unions', 'deref_refs', 'actual_objects', 'static_members', 'max_elements', 'repeat_threshold', and 'format'. +* New commands + +pipe [COMMAND] | SHELL_COMMAND +| [COMMAND] | SHELL_COMMAND + Executes COMMAND and sends its output to SHELL_COMMAND. + With no COMMAND, repeat the last executed command + and send its output to SHELL_COMMAND. + *** Changes in GDB 8.3 * GDB and GDBserver now support access to additional registers on diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 0733e1acfd..9467b8c4ec 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -1454,6 +1454,43 @@ Execute the @code{make} program with the specified arguments. This is equivalent to @samp{shell make @var{make-args}}. @end table +@table @code +@kindex pipe +@kindex | +@cindex send the output of a gdb command to a shell command +@anchor{pipe} +@item pipe [@var{command}] | @var{shell_command} +@itemx | [@var{command}] | @var{shell_command} +@item pipe -d@var{X} @var{command} @var{X} @var{shell_command} +@itemx | -d@var{X} @var{command} @var{X} @var{shell_command} +Executes @var{command} and sends its output to @var{shell_command}. +Note that no space is needed around @code{|}. +If no @var{command} is provided, the last command executed is repeated. + +If the @var{command} contains a @code{|}, then the option @code{-d@var{X}} +can be used to specify an alternate character that separates +the @var{command} from the @var{shell_command}. + +Example: +@smallexample +(gdb) pipe p full|wc + 5 17 81 +(gdb) |p full|wc -l +5 +(gdb) p full +$4 = (black => 144, + red => 233, + green => 377, + blue => 610, + white => 987) +(gdb) ||grep red + red => 233, +(gdb) | -d! echo this contains a | char\n ! sed -e 's/|/PIPE/' +this contains a PIPE char +(gdb) +@end smallexample +@end table + @node Logging Output @section Logging Output @cindex logging @value{GDBN} output @@ -1482,6 +1519,8 @@ Set @code{redirect} if you want output to go only to the log file. Show the current values of the logging settings. @end table +You can also redirect the output of a @value{GDBN} command to a +shell command. @xref{pipe}. @node Commands @chapter @value{GDBN} Commands