aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-file.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-02-04 12:27:28 +0100
committerPedro Alves <palves@redhat.com>2015-02-04 12:27:28 +0100
commit518be979d905d8e8708c70149fdb3207aba53aa1 (patch)
tree96dcab35188d23687ff67cb799b0d3351bbcc22f /gdb/tui/tui-file.c
parentf3853b34448594744f284fa96f26e41fd533a50d (diff)
downloadgdb-518be979d905d8e8708c70149fdb3207aba53aa1.zip
gdb-518be979d905d8e8708c70149fdb3207aba53aa1.tar.gz
gdb-518be979d905d8e8708c70149fdb3207aba53aa1.tar.bz2
Speed up GDB's TUI output
In the TUI mode, we call wrefresh after outputting every single character. This results in the I/O becoming very slow. Fix this by delaying refreshing the console window until an explicit flush of gdb_stdout is requested, or a write to any other (unbuffered) file is done. 2015-02-04 Doug Evans <dje@google.com> Pedro Alves <palves@redhat.com> Eli Zaretskii <eliz@gnu.org> PR tui/17810 * tui/tui-command.c (tui_refresh_cmd_win): New function. * tui/tui-command.c (tui_refresh_cmd_win): Declare. * tui/tui-file.c: #include tui/tui-command.h. (tui_file_fputs): Refresh command window if stream is not gdb_stdout. (tui_file_flush): Refresh command window if stream is gdb_stdout. * tui/tui-io.c (tui_puts): Remove calls to wrefresh, fflush.
Diffstat (limited to 'gdb/tui/tui-file.c')
-rw-r--r--gdb/tui/tui-file.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index b32cfa6..4b4b92c 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -20,7 +20,7 @@
#include "ui-file.h"
#include "tui/tui-file.h"
#include "tui/tui-io.h"
-
+#include "tui/tui-command.h"
#include "tui.h"
/* A ``struct ui_file'' that is compatible with all the legacy
@@ -179,6 +179,10 @@ tui_file_fputs (const char *linebuffer, struct ui_file *file)
else
{
tui_puts (linebuffer);
+ /* gdb_stdout is buffered, and the caller must gdb_flush it at
+ appropriate times. Other streams are not so buffered. */
+ if (file != gdb_stdout)
+ tui_refresh_cmd_win ();
}
}
@@ -239,6 +243,10 @@ tui_file_flush (struct ui_file *file)
case astring:
break;
case afile:
+ /* gdb_stdout is buffered. Other files are always flushed on
+ every write. */
+ if (file == gdb_stdout)
+ tui_refresh_cmd_win ();
fflush (stream->ts_filestream);
break;
}