This is the mail archive of the 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: [PATCH] Speed up "gdb -tui" output

On 01/06/2015 06:37 PM, Doug Evans wrote:

> Having written all that, asking the caller to know to do
> wrefresh at the needed times could be onerous.
> One thing that occurs to me is that gdb does do things like:
> Reading symbols from foo ... (work work work) done.
> And if I do that on my standard monster benchmark (fortunately
> I keep a ready-to-use copy lying around for experiments like this :-))
> I see a long pause before "done." is printed.
> And lo and behold, if I apply your patch I see this:
> bash$ gdb -tui
> (gdb) file foo<ret>
> At this point I've hit return but I don't see anything printed.
> pause pause pause
> and then finally I see all the output:
> Reading symbols from foo...done.
> mumble ...
> (gdb)

Since stdout is line buffered by default (on Unix), if this is
working when the TUI is disabled, then it must be because there's
explicit gdb_flush(gdb_stdout) after "Reading symbols from foo..."
is printed, right?

Isn't the issue then that the TUI's implementation of
gdb_flush (tui/tui-file.c) should be doing whatever it
needs to flush the output?  Should it be calling wrefresh
if the file is gdb_stdout?  If we do that, and change tui_puts like:

 -  /* We could defer the following.  */
 -  wrefresh (w);
 -  fflush (stdout);
 +   if (c == '\n')
 +    gdb_flush (gdb_stdout);

would it work?

Pedro Alves

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