diff options
author | Tom Tromey <tom@tromey.com> | 2020-04-13 12:42:59 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-13 14:10:04 -0600 |
commit | c1cd3163d99efe4f7cbe7f228859fd93f28e06bb (patch) | |
tree | f2d1b73cc5091ec29f88ea2ba2ad82002650c73d /gdb | |
parent | 29f2bf4f224c7b6a02b4acc3e1c22fd776dbc013 (diff) | |
download | fsf-binutils-gdb-c1cd3163d99efe4f7cbe7f228859fd93f28e06bb.zip fsf-binutils-gdb-c1cd3163d99efe4f7cbe7f228859fd93f28e06bb.tar.gz fsf-binutils-gdb-c1cd3163d99efe4f7cbe7f228859fd93f28e06bb.tar.bz2 |
Introduce and use flush_streams
Code in gdbsupport can't call gdb_flush, so this introduces a new
"flush_streams" function that must be supplied by the client.
Note that the similar gdb_flush_out_err exists, but it isn't defined
in quite the same way, so it wasn't clear to me whether the two could
be merged.
gdb/ChangeLog
2020-04-13 Tom Tromey <tom@tromey.com>
* utils.c (flush_streams): New function.
* event-loop.c (gdb_wait_for_event): Call flush_streams.
gdbsupport/ChangeLog
2020-04-13 Tom Tromey <tom@tromey.com>
* errors.h (flush_streams): Declare.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/event-loop.c | 3 | ||||
-rw-r--r-- | gdb/utils.c | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d4facee..c0b3ae7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-04-13 Tom Tromey <tom@tromey.com> + * utils.c (flush_streams): New function. + * event-loop.c (gdb_wait_for_event): Call flush_streams. + +2020-04-13 Tom Tromey <tom@tromey.com> + * event-loop.c (handle_file_event): Use warning, not printf_unfiltered. diff --git a/gdb/event-loop.c b/gdb/event-loop.c index a5d2f6f..4ce8899 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -663,8 +663,7 @@ gdb_wait_for_event (int block) int num_found = 0; /* Make sure all output is done before getting another event. */ - gdb_stdout->flush (); - gdb_stderr->flush (); + flush_streams (); if (gdb_notifier.num_fds == 0) return -1; diff --git a/gdb/utils.c b/gdb/utils.c index f5b2033..2f2cd84 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -691,6 +691,15 @@ malloc_failure (long size) } } +/* See common/errors.h. */ + +void +flush_streams () +{ + gdb_stdout->flush (); + gdb_stderr->flush (); +} + /* My replacement for the read system call. Used like `read' but keeps going if `read' returns too soon. */ |