This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to redirect output of sub program in target extended-remote


On Sun, 17 Apr 2011 16:09:39 +0200, Amker.Cheng wrote:
> I wonder whether '2' in your command stands for stderr as in shell command
> line?

Yes.


> when I typed following command:
> (gdb) target extended-remote | stub_program 1>/tmp/file
> the GDB always failed the connect with message:
> Ignoring packet error, continuing...
> warning: unrecognized item "timeout" in "qSupported" response

$ info '(gdb)Connecting'
`target remote | COMMAND'
	it should expect remote protocol packets on its standard input, and
	send replies on its standard output.

Therefore 1>/tmp/file is the same as >/tmp/file and this way no gdbserver
packets can be received by GDB.


> while your command ran successfully.

STDERR (2) is not used for gdbserver communication, only STDIN (0)
and STDOUT (1).

If stub_program outputs anything to stdout on its own it (a) cannot be visible
on the screen and (b) it is corrupting the gdbserver protocol although the
gdbserver protocol is resistant against such extraneous data.


> I did not understand the pipe in gdb command line well and did not
> find any doc on it. So could you point out some doc and let me learn
> it.

This is normal shell processing, see `man bash'.


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]