diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-04-24 08:39:19 -0700 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2022-04-24 08:39:19 -0700 |
commit | ac16b09d7e5fd0013ffa27e4d0531c0af12a529a (patch) | |
tree | 2279a478129e5f341dca19210a0eeb39620a5578 /gdb/event-top.c | |
parent | 69be4d89e30e0a6f0476ede2e34748330cd72445 (diff) | |
download | gdb-ac16b09d7e5fd0013ffa27e4d0531c0af12a529a.zip gdb-ac16b09d7e5fd0013ffa27e4d0531c0af12a529a.tar.gz gdb-ac16b09d7e5fd0013ffa27e4d0531c0af12a529a.tar.bz2 |
gdb: move setbuf calls out of gdb_readline_no_editing_callback
After this commit:
commit d08cbc5d3203118da5583296e49273cf82378042
Date: Wed Dec 22 12:57:44 2021 +0000
gdb: unbuffer all input streams when not using readline
Issues were reported with some MS-Windows hosts, see the thread
starting here:
https://sourceware.org/pipermail/gdb-patches/2022-March/187004.html
Filed in bugzilla as: PR mi/29002
The problem seems to be that calling setbuf on terminal file handles
is not always acceptable, see this mail for more details:
https://sourceware.org/pipermail/gdb-patches/2022-April/187310.html
This commit does two things, first moving the setbuf calls out of
gdb_readline_no_editing_callback so that we don't end up calling
setbuf so often.
Then, for MS-Windows hosts, we don't call setbuf for terminals, this
appears to resolve the issues that have been reported.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29002
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r-- | gdb/event-top.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c index 3566431..74960c8 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -863,19 +863,6 @@ gdb_readline_no_editing_callback (gdb_client_data client_data) FILE *stream = ui->instream != nullptr ? ui->instream : ui->stdin_stream; gdb_assert (stream != nullptr); - /* Unbuffer the input stream, so that, later on, the calls to fgetc - fetch only one char at the time from the stream. The fgetc's will - get up to the first newline, but there may be more chars in the - stream after '\n'. If we buffer the input and fgetc drains the - stream, getting stuff beyond the newline as well, a select, done - afterwards will not trigger. - - This unbuffering was, at one point, not applied if the input stream - was a tty, however, the buffering can cause problems, even for a tty, - in some cases. Please ensure that any changes in this area run the MI - tests with the FORCE_SEPARATE_MI_TTY=1 flag being passed. */ - setbuf (stream, NULL); - /* We still need the while loop here, even though it would seem obvious to invoke gdb_readline_no_editing_callback at every character entered. If not using the readline library, the |