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

Jan Kratochvil
2011-08-13T17:24:18Z

On Fri, 05 Aug 2011 11:41:09 +0200, Abhijit Halder wrote:
> On Fri, Aug 5, 2011 at 1:59 PM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > I would prefer to also redirect gdb_stderr, gdb_stdlog, gdb_stdtarg and
> > gdb_stdtargerr like set_logging_redirect does. Â This is like if one
> > uses |& instead of | . Â I understand someone may have a different opinion.
> > In such case there even may be some option of the command pipe for it.
> I understand your point here, but this will break out very basic
> assumption that delimiter is single character.
> Can we skip this at this point? Or simply we can redirect gdb_stderror
> to pipe as in most of the cases that will be equivalent to gdb_stdout.
> (My understanding was that the error from gdb can be captured anyway
> by error logging mechanism, the use-case of using pipe, I believe, is
> when the gdb output is huge and one wants to process that huge
> output.) Please suggest.

The reason for redirecting also errors I find that when you type:

$ ls /tmp bar|less

you happilly see the content of /tmp but the message

ls: cannot access bar: No such file or directory

gets completely lost. This is why I find |& safer for normal use cases.

(One can argue also the other way, that standard shell pipe | also does not
automatically redirect stderr, though.)

Thanks,
Jan