From patchwork Sat Apr 20 21:21:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 32351 Received: (qmail 45665 invoked by alias); 20 Apr 2019 21:22:13 -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 45577 invoked by uid 89); 20 Apr 2019 21:22:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.3 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=Shell, Commands, white, HContent-Transfer-Encoding:8bit X-HELO: mailsec111.isp.belgacom.be Received: from mailsec111.isp.belgacom.be (HELO mailsec111.isp.belgacom.be) (195.238.20.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 20 Apr 2019 21:22:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1555795331; x=1587331331; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pHEqvFBZZkLEnTrJpizPR5g1FCzKc5eaMN25ES4axkM=; b=pM7XCWtvf3rqJRdUeMoWtsTi9R3aeIC7n4pYEJOAZndHQTzg0+t/lOyd gsJI5QUDSOP+DQCslgP8lKp3lc+qhQ==; Received: from unknown (HELO md.home) ([109.131.123.45]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 20 Apr 2019 23:21:59 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA 4/4] NEWS and documentation for | (pipe) command. Date: Sat, 20 Apr 2019 23:21:53 +0200 Message-Id: <20190420212153.30934-5-philippe.waroquiers@skynet.be> In-Reply-To: <20190420212153.30934-1-philippe.waroquiers@skynet.be> References: <20190420212153.30934-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 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 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 a3a5f3e28c..0350958d4e 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -1454,6 +1454,35 @@ 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} +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. + +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) +@end smallexample +@end table + @node Logging Output @section Logging Output @cindex logging @value{GDBN} output @@ -1482,6 +1511,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. See @ref{pipe}. @node Commands @chapter @value{GDBN} Commands