Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [RFA 4/4] NEWS and documentation for | (pipe) command.
Date: Sat, 20 Apr 2019 21:22:00 -0000	[thread overview]
Message-ID: <20190420212153.30934-5-philippe.waroquiers@skynet.be> (raw)
In-Reply-To: <20190420212153.30934-1-philippe.waroquiers@skynet.be>

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
 
-- 
2.20.1


  parent reply	other threads:[~2019-04-20 21:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 21:22 [RFA 0/4] Implement " Philippe Waroquiers
2019-04-20 21:22 ` [RFA 1/4] Add previous_saved_command_line to allow a command to repeat a previous command Philippe Waroquiers
2019-04-24 20:51   ` Tom Tromey
2019-04-20 21:22 ` [RFA 3/4] Test the | (pipe) command Philippe Waroquiers
2019-04-24 20:52   ` Tom Tromey
2019-04-20 21:22 ` [RFA 2/4] Implement " Philippe Waroquiers
2019-04-21  5:19   ` Eli Zaretskii
2019-04-21  9:40     ` Philippe Waroquiers
2019-04-21 10:18       ` Eli Zaretskii
2019-04-22 10:30         ` Philippe Waroquiers
2019-04-22 11:08           ` Eli Zaretskii
2019-04-22 13:15             ` Philippe Waroquiers
2019-04-22 13:21               ` Eli Zaretskii
2019-04-24 20:50   ` Tom Tromey
2019-04-25  5:58     ` Eli Zaretskii
2019-04-20 21:22 ` Philippe Waroquiers [this message]
2019-04-21  5:22   ` [RFA 4/4] NEWS and documentation for " Eli Zaretskii
2019-04-22 20:45 ` [RFA 0/4] Implement " Abhijit Halder
2019-04-22 21:14   ` Philippe Waroquiers
2019-04-24 20:53   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190420212153.30934-5-philippe.waroquiers@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox