Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: "Amker.Cheng" <amker.cheng@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: how to redirect output of sub program in target extended-remote
Date: Sun, 17 Apr 2011 15:39:00 -0000	[thread overview]
Message-ID: <20110417153846.GA21796@host1.jankratochvil.net> (raw)
In-Reply-To: <BANLkTinv4EwR1K7_qZqXhLM6x-tKEsbLQQ@mail.gmail.com>

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


  reply	other threads:[~2011-04-17 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-17  8:06 Amker.Cheng
2011-04-17 13:35 ` Jan Kratochvil
2011-04-17 14:09   ` Amker.Cheng
2011-04-17 15:39     ` Jan Kratochvil [this message]
2011-04-18 10:21       ` Amker.Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110417153846.GA21796@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=amker.cheng@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox