This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: printfs output in wrong order in MI
On Thursday 13 April 2006 11:55, Eli Zaretskii wrote:
> > > Any ideas why "printf" is so special?
> >
> > I turns out that using
> >
> > printf "%x\n", &i
> >
> > (that is, adding "\n"), fixes the problem. Still looks like a bug to me,
> > though.
>
> I think it's expected behavior: printf uses buffered output,
Where in documentation is it stated that 'printf' uses buffered output?
> so if you
> don't finish the line with a newline, the buffer is not flushed.
> Similar ``bugs'' can be seen in any C program that displays characters
> via printf without \n or fflush.
Isn't it possible to auto-flush the buffer at the end of "-interpreter-exec
console" execution it's possible to flush the buffers? I think it's
reasonable to expect that *all* output of command wrapped in
"-interpreter-exec console" would appears before the "^done" marker.
- Volodya