Not seeing target output in GDB/MI

Johannes Overmann
Fri Dec 10 10:12:00 GMT 2004


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.



More information about the Gdb mailing list