diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-02-05 12:25:09 +0100 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-02-07 14:06:02 -0700 |
commit | faa17681ccf5b45a14424c184d867a390d9e8086 (patch) | |
tree | 63260d1dcb10d65f984fffebca177c520eb3ac04 /gdb | |
parent | 5abbbe1d13e03496af5564b997f3c3a2e79b4d73 (diff) | |
download | gdb-faa17681ccf5b45a14424c184d867a390d9e8086.zip gdb-faa17681ccf5b45a14424c184d867a390d9e8086.tar.gz gdb-faa17681ccf5b45a14424c184d867a390d9e8086.tar.bz2 |
Make gdb_flush also flush the wrap buffer
This changes gdb_flush to also flush the internal wrap buffer. A few
places needed to continue using the previous approach, so this also
introduces ui_file_flush for those.
2020-02-05 Iain Buclaw <ibuclaw@gdcproject.org>
* gdb/event-loop.c (gdb_wait_for_event): Update.
* gdb/printcmd.c (printf_command): Update.
* gdb/remote-fileio.c (remote_fileio_func_write): Update.
* gdb/remote-sim.c (gdb_os_flush_stdout): Update.
(gdb_os_flush_stderr): Update.
* gdb/remote.c (remote_console_output): Update.
* gdb/ui-file.c (gdb_flush): Rename to...
(ui_file_flush): ...this.
(stderr_file::write): Update.
(stderr_file::puts): Update.
* gdb/ui-file.h (gdb_flush): Rename to...
(ui_file_flush): ...this.
* gdb/utils.c (gdb_flush): Add function.
* gdb/utils.h (gdb_flush): Add declaration.
Change-Id: I7ca143d30f03dc39f218f6e880eb9bca9e15af39
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/event-loop.c | 4 | ||||
-rw-r--r-- | gdb/event-top.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/remote-fileio.c | 2 | ||||
-rw-r--r-- | gdb/remote-sim.c | 4 | ||||
-rw-r--r-- | gdb/remote.c | 2 | ||||
-rw-r--r-- | gdb/ui-file.c | 6 | ||||
-rw-r--r-- | gdb/ui-file.h | 2 | ||||
-rw-r--r-- | gdb/utils.c | 9 | ||||
-rw-r--r-- | gdb/utils.h | 6 |
11 files changed, 44 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 26fffd7..f3667bb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2020-02-05 Iain Buclaw <ibuclaw@gdcproject.org> + + * gdb/event-loop.c (gdb_wait_for_event): Update. + * gdb/printcmd.c (printf_command): Update. + * gdb/remote-fileio.c (remote_fileio_func_write): Update. + * gdb/remote-sim.c (gdb_os_flush_stdout): Update. + (gdb_os_flush_stderr): Update. + * gdb/remote.c (remote_console_output): Update. + * gdb/ui-file.c (gdb_flush): Rename to... + (ui_file_flush): ...this. + (stderr_file::write): Update. + (stderr_file::puts): Update. + * gdb/ui-file.h (gdb_flush): Rename to... + (ui_file_flush): ...this. + * gdb/utils.c (gdb_flush): Add function. + * gdb/utils.h (gdb_flush): Add declaration. + 2020-02-07 Tom Tromey <tromey@adacore.com> PR breakpoints/24915: diff --git a/gdb/event-loop.c b/gdb/event-loop.c index 65a35b4..fbe6aa4 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -750,8 +750,8 @@ gdb_wait_for_event (int block) int num_found = 0; /* Make sure all output is done before getting another event. */ - gdb_flush (gdb_stdout); - gdb_flush (gdb_stderr); + ui_file_flush (gdb_stdout); + ui_file_flush (gdb_stderr); if (gdb_notifier.num_fds == 0) return -1; diff --git a/gdb/event-top.c b/gdb/event-top.c index 3f10b21..1bfc28e 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -416,7 +416,7 @@ display_gdb_prompt (const char *new_prompt) /* Don't use a _filtered function here. It causes the assumed character position to be off, since the newline we read from the user is not accounted for. */ - fputs_unfiltered (actual_gdb_prompt.c_str (), gdb_stdout); + fprintf_unfiltered (gdb_stdout, "%s", actual_gdb_prompt.c_str ()); gdb_flush (gdb_stdout); } } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 5f2678c..cee0c88 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2720,7 +2720,7 @@ printf_command (const char *arg, int from_tty) ui_printf (arg, gdb_stdout); reset_terminal_style (gdb_stdout); wrap_here (""); - gdb_flush (gdb_stdout); + ui_file_flush (gdb_stdout); } /* Implement the "eval" command. */ diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index e750683..40add06 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -641,7 +641,7 @@ remote_fileio_func_write (remote_target *remote, char *buf) case FIO_FD_CONSOLE_OUT: ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr, (char *) buffer, length); - gdb_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr); + ui_file_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr); ret = length; break; default: diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index b7ce467..ce13517 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -360,7 +360,7 @@ gdb_os_write_stdout (host_callback *p, const char *buf, int len) static void gdb_os_flush_stdout (host_callback *p) { - gdb_flush (gdb_stdtarg); + ui_file_flush (gdb_stdtarg); } /* GDB version of os_write_stderr callback. */ @@ -385,7 +385,7 @@ gdb_os_write_stderr (host_callback *p, const char *buf, int len) static void gdb_os_flush_stderr (host_callback *p) { - gdb_flush (gdb_stdtargerr); + ui_file_flush (gdb_stdtargerr); } /* GDB version of printf_filtered callback. */ diff --git a/gdb/remote.c b/gdb/remote.c index dafdfa8..11ec857 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6847,7 +6847,7 @@ remote_console_output (const char *msg) tb[1] = 0; fputs_unfiltered (tb, gdb_stdtarg); } - gdb_flush (gdb_stdtarg); + ui_file_flush (gdb_stdtarg); } struct stop_reply : public notif_event diff --git a/gdb/ui-file.c b/gdb/ui-file.c index af128b0..2d9a378 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -91,7 +91,7 @@ null_file::write_async_safe (const char *buf, long sizeof_buf) void -gdb_flush (struct ui_file *file) +ui_file_flush (struct ui_file *file) { file->flush (); } @@ -315,7 +315,7 @@ stdio_file::can_emit_style_escape () void stderr_file::write (const char *buf, long length_buf) { - gdb_flush (gdb_stdout); + ui_file_flush (gdb_stdout); stdio_file::write (buf, length_buf); } @@ -325,7 +325,7 @@ stderr_file::write (const char *buf, long length_buf) void stderr_file::puts (const char *linebuffer) { - gdb_flush (gdb_stdout); + ui_file_flush (gdb_stdout); stdio_file::puts (linebuffer); } diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 1df477d..b0bc3f2 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -100,7 +100,7 @@ public: /* A preallocated null_file stream. */ extern null_file null_stream; -extern void gdb_flush (ui_file *); +extern void ui_file_flush (ui_file *); extern int ui_file_isatty (struct ui_file *); diff --git a/gdb/utils.c b/gdb/utils.c index fe874fb..b722296 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1544,6 +1544,15 @@ flush_wrap_buffer (struct ui_file *stream) } } +/* See utils.h. */ + +void +gdb_flush (struct ui_file *stream) +{ + flush_wrap_buffer (stream); + ui_file_flush (stream); +} + /* Indicate that if the next sequence of characters overflows the line, a newline should be inserted here rather than when it hits the end. If INDENT is non-null, it is a string to be printed to indent the diff --git a/gdb/utils.h b/gdb/utils.h index 6a0927c..3434ff1 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -320,6 +320,12 @@ extern struct ui_file **current_ui_gdb_stdin_ptr (void); extern struct ui_file **current_ui_gdb_stderr_ptr (void); extern struct ui_file **current_ui_gdb_stdlog_ptr (void); +/* Flush STREAM. This is a wrapper for ui_file_flush that also + flushes any output pending from uses of the *_filtered output + functions; that output is kept in a special buffer so that + pagination and styling are handled properly. */ +extern void gdb_flush (struct ui_file *); + /* The current top level's ui_file streams. */ /* Normal results */ |