diff mbox

[RFA,4/4] NEWS and documentation for | (pipe) command.

Message ID 20190420212153.30934-5-philippe.waroquiers@skynet.be
State New
Headers show

Commit Message

Philippe Waroquiers April 20, 2019, 9:21 p.m. UTC
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(+)

Comments

Eli Zaretskii April 21, 2019, 5:22 a.m. UTC | #1
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Sat, 20 Apr 2019 23:21:53 +0200
> 
> 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.
> +

This is OK.

> +You can also redirect the output of a @value{GDBN} command to a
> +shell command.  See @ref{pipe}.
                   ^^^^^^^^^^^^^^
This isn't incorrect, bur @xref{pipe} is better.

Otherwise, the documentation part is OK, thanks.
diff mbox

Patch

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