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

Jan Kratochvil
2011-08-13T20:58:24Z

On Sat, 13 Aug 2011 20:09:57 +0200, Abhijit Halder wrote:
> I have also redirected the gdb_stderr to pipe.
[...]
> + gdb_stdout = fp;
> + gdb_stderr = fp;
> + gdb_stdlog = fp;
> + gdb_stdtarg = fp;
> + gdb_stdtargerr = fp;
> + execute_command (pipe->gdb_cmd, from_tty);
>
> But the error is still coming on screen.
>
> (gdb) pipe | print xxx | vim -
> Vim: Reading from stdin...
>
> No symbol table is loaded. Use the "file" command.
> (gdb) pipe | print 2 | vim -
> Vim: Reading from stdin...
>
> (gdb)

Hmm, true, the error message is stored in the block but the error message is
printed only after the exception cleanups were run. You can use there (do not
use this indentation):

{ volatile struct gdb_exception except;
TRY_CATCH (except, RETURN_MASK_ERROR)
{
execute_command (pipe->gdb_cmd, from_tty);
}
if (except.reason < 0)
exception_print (gdb_stderr, except);
}

Thanks,
Jan