diff options
author | Aaron Merey <amerey@redhat.com> | 2024-01-12 14:38:45 -0500 |
---|---|---|
committer | Aaron Merey <amerey@redhat.com> | 2024-01-19 00:18:00 -0500 |
commit | 519d634396592c5698add4a327468e6e6920576e (patch) | |
tree | 695c241945e77efdfae59af2a33922425cb8f290 /gdb/infrun.c | |
parent | 64db3e4d881d347704139c89d90048082774c9cc (diff) | |
download | binutils-519d634396592c5698add4a327468e6e6920576e.zip binutils-519d634396592c5698add4a327468e6e6920576e.tar.gz binutils-519d634396592c5698add4a327468e6e6920576e.tar.bz2 |
gdb: Buffer output streams during events that might download debuginfo
Introduce new ui_file buffering_file to temporarily collect output
written to gdb_std* output streams during print_thread, print_frame_info
and print_stop_event.
This ensures that output during these functions is not interrupted
by debuginfod progress messages.
With the addition of deferred debuginfo downloading it is possible
for download progress messages to print during these events.
Without any intervention we can end up with poorly formatted output:
(gdb) backtrace
[...]
#8 0x00007fbe8af7d7cf in pygi_invoke_c_callable (Downloading separate debug info for /lib64/libpython3.11.so.1.0
function_cache=0x561221b224d0, state=<optimized out>...
To fix this we buffer writes to gdb_std* output streams while allowing
debuginfod progress messages to skip the buffers and print to the
underlying output streams immediately. Buffered output is then written
to the output streams. This ensures that progress messages print first,
followed by uninterrupted frame/thread/stop info:
(gdb) backtrace
[...]
Downloading separate debug info for /lib64/libpython3.11.so.1.0
#8 0x00007fbe8af7d7cf in pygi_invoke_c_callable (function_cache=0x561221b224d0, state=<optimized out>...
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index 3f0f69b..d8c1bca 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9277,10 +9277,10 @@ print_stop_location (const target_waitstatus &ws) print_stack_frame (get_selected_frame (nullptr), 0, source_flag, 1); } -/* See infrun.h. */ +/* See `print_stop_event` in infrun.h. */ -void -print_stop_event (struct ui_out *uiout, bool displays) +static void +do_print_stop_event (struct ui_out *uiout, bool displays) { struct target_waitstatus last; struct thread_info *tp; @@ -9309,6 +9309,16 @@ print_stop_event (struct ui_out *uiout, bool displays) } } +/* See infrun.h. This function itself sets up buffered output for the + duration of do_print_stop_event, which performs the actual event + printing. */ + +void +print_stop_event (struct ui_out *uiout, bool displays) +{ + do_with_buffered_output (do_print_stop_event, uiout, displays); +} + /* See infrun.h. */ void |