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

Jan Kratochvil
2011-08-02T15:45:11Z

On Tue, 02 Aug 2011 10:52:27 +0200, Abhijit Halder wrote:
> On Tue, Aug 2, 2011 at 12:24 PM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> Yes. I made this option (-r) available just to make the code
> futuristic.

It is nice to have the syntax ready for future extensions but one does not
have to code the extensions when they still have no use.

> >> Â - Â  Â end of gdb option list
> >> dlim (delimiter) is a single ASCII character from the set below:
> >> {|/\'"`#@!$%^} (We actually can remove this restriction).
> >
> > I would prefer first to agree on the proper syntax. Â I do not find
> >
> > (gdb) pipe | print 1 | less
> >
> > to be something a new user will ever try whether it does not work.

I missed the very first thread named "PATCH" which already discussed this part
so I am fine now with the "pipe" command.

> > If there is pipe `|' GDB could support also redirections '>', '>>', '2>&1',
> > '&>', '|&' besides '|' etc.
> >
> The same can still be very much possible with pipe command in place. For e.g.
> (gdb) pipe | thread apply all bt | grep "foobar" 2>&1 | tee myLog.txt

I was referring to for example
(gdb) pipe print variable >somefile

GDB also prints its errors to gdb_stderr, therefore you may need:

(gdb) pipe print nonexistingvariable |& tee file

if you want to redirect also the error message of the GDB "print" command.

But it all means a single delimiter would not be enough. Still one can
backslash the syntax:

(gdb) pipe print 1 \| 2 | tee file-will-contain-3

(gdb) echo <<<hello>>>\n
(gdb) pipe echo \<\<\<hello\>\>\>\\n >file

Sure maybe "pipe" is no longer the right name and "redirect" or so matches the
functionality better.

This is just a proposal. I see I jumped late to the thread. Still I would
prefer some final syntax agreement.

Thanks,
Jan