[PATCH 0/4] Audit uses of unfiltered output to gdb_stdout

Tom Tromey tom@tromey.com
Thu Jan 6 17:28:20 GMT 2022


My belief is that some gdb output must be unfiltered -- in particular,
I think infrun is probably not set up to handle a quit thrown from a
paging prompt that was caused by some thread-event user notification.

However, many such calls aren't actually needed, or, if they are
needed, should be sent to either gdb_stderr or gdb_stdlog.

I went through all the text output in gdb, looking for unfiltered
output to gdb_stdout.  This series is the result.

After this, I think all _unfiltered calls that don't explicitly pass a
ui_file (that is, calls like printf_unfiltered and not
fprintf_unfiltered) should remain as unfiltered.  But, all calls that
*do* pass a ui_file are either (1) sending to gdb_stdout and come from
a location that can comfortably be switched to _filtered; or (2) are
sending to some other stream, where filtering is irrelevant.

One final oddity is complete_command.  This is explicitly unfiltered
due to its use by Emacs.  I considered (and even wrote a patch for)
changing the "server" prefix to disable filtering; but in the end I
wasn't sure whether this would break some client.  It seemed horribly
possible to me that some client out there could look for the pager
prompt to limit the number of completions.

This series is the last step before the pager rewrite can be sent.
I've broken things down into sub-series to make review a little less
daunting.  (Note that the wrap_here, Darwin output, and
timestamped_file patches also must land before the pager.)

Regression tested on x86-64 Fedora 34.

Tom




More information about the Gdb-patches mailing list