Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell.

Jan Kratochvil
2011-08-05T09:09:51Z

On Fri, 05 Aug 2011 10:52:16 +0200, Pedro Alves wrote:
> On Friday 05 August 2011 09:29:47, Jan Kratochvil wrote:
> > (gdb) pipe info threads | less
> > (gdb) pipe : print 1 | 2 : less
> > (gdb) pipe FOO print 1 | 2 FOO less
> > etc.
>
> That way you can't tell if FOO is a token or a random gdb
> command, unless you forbit tokens that are command names.

Oops, I noticed only after sending it...

> I had suggested:
>
> "We can tweak the syntax a bit to support
> options to the pipe command. E.g, define that
> the pipe command always ends with a lone '-' before

One point is it should be `--' instead of `-' to be GNU getopt-like compliant.

I am still not fond of any mandatory character there if in 99% of uses cases
one can just default to `|'. `pipe' is there for convenience, one can already
get reach the same functionality with some defined canned command sequence
with `set logging'.

> which brings us back to the current proposed
> syntax, except for the split token not being limited to
> some set of fixed characters.

To make the most common use case with `|' the most simple to type:
(gdb) pipe print 1 | less

one could consider the first argument a delimiter if it is a single-character
and ispunct().

(gdb) pipe print 1 | less
(gdb) pipe : print 1 | 2 : less

If one really needs to enter ispunct() single-character command one still can:

(gdb) pipe | + plus-args

if + is a valid GDB command.

Thanks,
Jan