This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 08/25] Make input_fd be per UI
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 6 May 2016 12:53:38 +0100
- Subject: Re: [PATCH v2 08/25] Make input_fd be per UI
- Authentication-results: sourceware.org; auth=none
- References: <1458573675-15478-1-git-send-email-palves at redhat dot com> <1458573675-15478-9-git-send-email-palves at redhat dot com> <86oaa6vo9o dot fsf at gmail dot com>
On 03/22/2016 09:46 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> @@ -498,6 +504,10 @@ target_terminal_inferior (void)
>> void
>> target_terminal_ours (void)
>> {
>> + struct ui *ui = current_ui;
>> +
>> + add_file_handler (ui->input_fd, stdin_event_handler, ui);
>> +
>> if (terminal_state == terminal_is_ours)
>> return;
>
> We should call add_file_handler after the terminal_state check above.
>
We actually shouldn't, because terminal_state only refers to the
state of gdb's main tty state, while we still want to add/remove
the _current_ UI's input_fd from the event loop. I've added
comments in v3.
Note that I'm gradually bubbling up these input_fd calls from the
targets backends towards common code. At some point I'd like to
migrate them somewhere even higher, maybe merged with
async_disable_stdin / async_enable_stdin, now that since the ctrl-c
rework series we only call target_terminal_ours when we really need
input. But that'll be yet another set of
cleaning-up-all-over-the-tree that I'd much rather not do
along with this series.
Thanks,
Pedro Alves