public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Not seeing target output in GDB/MI
@ 2004-12-10 10:12 Johannes Overmann
  2004-12-10 13:38 ` Daniel Jacobowitz
  2004-12-12 15:25 ` Andrew Cagney
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Overmann @ 2004-12-10 10:12 UTC (permalink / raw)
  To: gdb

Hi,

I am trying to use the GDB/MI interface of gdb 6.2.1 and my biggest problem
is currently that the output to stdout of my target program beeging debugged
is beeing block buffered. I am using pipes to communicate with gdb and the
output from gdb itself (e.g. responses from commands) does not seem to be
block buffered, it is line buffered which is what I also need for the target
output, which I get over the same file descriptor (pipe).

I am using gdb to debug a simple test program on Linux. No remote debugging
or something special at all.

The fact that the target output is buffered leads to the behavior that when
single stepping over some printf() calls I do not see the output during these
steps. I see the output when the program beeing debugged exits or when I do
a lot of output (the buffer gets flushed).

In DDD I do not see this behavior, but I saw that DDD uses a tty to
communicate with gdb and output to ttys is apparently line buffered.

I can factor out two simple questions:

- Is there a way to see the target output (stdout) unbuffered or line buffered
   and still using pipes to comminucate with gdb?

- Why is the target output not visible in the target-stream-output described in the
   MI documentation (e.g. prefixed by @)? I see it just as any other output
   coming from gdb without any indication that it comes from the target.

Any help on this is greatly appreciated.

Regards,

Johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Not seeing target output in GDB/MI
  2004-12-10 10:12 Not seeing target output in GDB/MI Johannes Overmann
@ 2004-12-10 13:38 ` Daniel Jacobowitz
  2004-12-12 15:25 ` Andrew Cagney
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-12-10 13:38 UTC (permalink / raw)
  To: Johannes Overmann; +Cc: gdb

On Fri, Dec 10, 2004 at 11:11:20AM +0100, Johannes Overmann wrote:
> I can factor out two simple questions:
> 
> - Is there a way to see the target output (stdout) unbuffered or line 
> buffered
>   and still using pipes to comminucate with gdb?
> 
> - Why is the target output not visible in the target-stream-output 
> described in the
>   MI documentation (e.g. prefixed by @)? I see it just as any other output
>   coming from gdb without any indication that it comes from the target.

They have the same answer: GDB does not support encapsulated output for
native targets.  What's probably happening is that the inferior is
writing to the same pipe that you used to communicate with GDB, and
your C library is defaulting to block buffering when it detects that
stdout is not a TTY.

Some remote targets offer output encapsulation.  It wouldn't be
terribly hard to implement for native, but it isn't terribly useful
either, so no one has done the work.  Easiest thing to do may be to use
the "tty" command in GDB.  I don't know if there's a matching MI
command.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Not seeing target output in GDB/MI
  2004-12-10 10:12 Not seeing target output in GDB/MI Johannes Overmann
  2004-12-10 13:38 ` Daniel Jacobowitz
@ 2004-12-12 15:25 ` Andrew Cagney
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2004-12-12 15:25 UTC (permalink / raw)
  To: Johannes Overmann; +Cc: gdb


> - Is there a way to see the target output (stdout) unbuffered or line 
> buffered
>   and still using pipes to comminucate with gdb?
> 
> - Why is the target output not visible in the target-stream-output 
> described in the
>   MI documentation (e.g. prefixed by @)? I see it just as any other output
>   coming from gdb without any indication that it comes from the target.

MI was first developed on a remote target where implementing this was 
relatively easy.  That isn't the case for native and the code was never 
written.   Instead, as you note for DDD, native MI clients use 'gdb 
--tty=...'.

Perhaphs the thing to do here is deprecate the MI mechanism and 
recommend -tty for both native and remote cases (this of course will 
mean that the remotes need to be changed).

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-12 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-10 10:12 Not seeing target output in GDB/MI Johannes Overmann
2004-12-10 13:38 ` Daniel Jacobowitz
2004-12-12 15:25 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).