GNU Binutils with patches for OS216
Revisão | c1cd3163d99efe4f7cbe7f228859fd93f28e06bb (tree) |
---|---|
Hora | 2020-04-14 05:10:04 |
Autor | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
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.
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2020-04-13 Tom Tromey <tom@tromey.com> |
2 | 2 | |
3 | + * utils.c (flush_streams): New function. | |
4 | + * event-loop.c (gdb_wait_for_event): Call flush_streams. | |
5 | + | |
6 | +2020-04-13 Tom Tromey <tom@tromey.com> | |
7 | + | |
3 | 8 | * event-loop.c (handle_file_event): Use warning, not |
4 | 9 | printf_unfiltered. |
5 | 10 |
@@ -663,8 +663,7 @@ gdb_wait_for_event (int block) | ||
663 | 663 | int num_found = 0; |
664 | 664 | |
665 | 665 | /* Make sure all output is done before getting another event. */ |
666 | - gdb_stdout->flush (); | |
667 | - gdb_stderr->flush (); | |
666 | + flush_streams (); | |
668 | 667 | |
669 | 668 | if (gdb_notifier.num_fds == 0) |
670 | 669 | return -1; |
@@ -691,6 +691,15 @@ malloc_failure (long size) | ||
691 | 691 | } |
692 | 692 | } |
693 | 693 | |
694 | +/* See common/errors.h. */ | |
695 | + | |
696 | +void | |
697 | +flush_streams () | |
698 | +{ | |
699 | + gdb_stdout->flush (); | |
700 | + gdb_stderr->flush (); | |
701 | +} | |
702 | + | |
694 | 703 | /* My replacement for the read system call. |
695 | 704 | Used like `read' but keeps going if `read' returns too soon. */ |
696 | 705 |
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2020-04-13 Tom Tromey <tom@tromey.com> |
2 | 2 | |
3 | + * errors.h (flush_streams): Declare. | |
4 | + | |
5 | +2020-04-13 Tom Tromey <tom@tromey.com> | |
6 | + | |
3 | 7 | * gdb_select.h: Move from ../gdb/. |
4 | 8 | |
5 | 9 | 2020-04-13 Tom Tromey <tom@tromey.com> |
@@ -87,4 +87,8 @@ extern void perror_with_name (const char *string) ATTRIBUTE_NORETURN; | ||
87 | 87 | |
88 | 88 | extern void malloc_failure (long size) ATTRIBUTE_NORETURN; |
89 | 89 | |
90 | +/* Flush stdout and stderr. Must be provided by the client. */ | |
91 | + | |
92 | +extern void flush_streams (); | |
93 | + | |
90 | 94 | #endif /* COMMON_ERRORS_H */ |