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

Pedro Alves
2011-08-05T08:52:38Z

On Friday 05 August 2011 09:29:47, Jan Kratochvil wrote:
> Why there should be such explicitly limited delimiter choice? Couldn't the
> pipe command default to '|' and otherwise take an arbitrary first word?
> (The word should never start with '-' to have the options extension possibility
> in the future.) That is to permit:
> (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.
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
the gdb command chain, and -t for pipe token, then:

No -t switch, assume `|' pipe token:

(gdb) pipe - bt | vim -

Specify alternate pipe token:

(gdb) pipe -t PIPE - p 1 | 2 PIPE vim -
"

We can get by without -t too, but we'd need
the `-', I think:

(gdb) pipe - bt | vim -
(gdb) pipe FOO - bt FOO vim -

But at this point, if we always need to spell out
`-', we might as well decide that you always
end the pipe command with the splitting token, that
is, the default of `|' doesn't really buy much:

(gdb) pipe - bt | vim -
(gdb) pipe FOO - bt FOO vim -
(gdb) pipe BAR - bt BAR vim -

vs

(gdb) pipe | bt | vim -
(gdb) pipe FOO bt FOO vim -
(gdb) pipe BAR bt BAR vim -

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

--
Pedro Alves