aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-23 11:05:39 -0600
committerTom Tromey <tromey@adacore.com>2022-07-18 08:49:55 -0600
commit8f7f9b3a9142eeea50054b83e9bce12056bae6c9 (patch)
tree57131ab1a2db760f8d6e56bbb04cfd02cc8ae361 /gdb/event-top.c
parentbbcab3366bc5269c2896e82ebd1b0f068ec9a50b (diff)
downloadfsf-binutils-gdb-8f7f9b3a9142eeea50054b83e9bce12056bae6c9.zip
fsf-binutils-gdb-8f7f9b3a9142eeea50054b83e9bce12056bae6c9.tar.gz
fsf-binutils-gdb-8f7f9b3a9142eeea50054b83e9bce12056bae6c9.tar.bz2
Remove ui_register_input_event_handler
This patch removes ui_register_input_event_handler and ui_unregister_input_event_handler, replacing them with methods on 'ui'. It also changes gdb to use these methods everywhere, rather than sometimes reaching in to the ui to manage the file descriptor directly.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 74960c8..2863a8a 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -491,7 +491,7 @@ stdin_event_handler (int error, gdb_client_data client_data)
/* Switch to the main UI, so diagnostics always go there. */
current_ui = main_ui;
- delete_file_handler (ui->input_fd);
+ ui->unregister_file_handler ();
if (main_ui == ui)
{
/* If stdin died, we may as well kill gdb. */
@@ -531,18 +531,18 @@ stdin_event_handler (int error, gdb_client_data client_data)
/* See top.h. */
void
-ui_register_input_event_handler (struct ui *ui)
+ui::register_file_handler ()
{
- add_file_handler (ui->input_fd, stdin_event_handler, ui,
- string_printf ("ui-%d", ui->num), true);
+ add_file_handler (input_fd, stdin_event_handler, this,
+ string_printf ("ui-%d", num), true);
}
/* See top.h. */
void
-ui_unregister_input_event_handler (struct ui *ui)
+ui::unregister_file_handler ()
{
- delete_file_handler (ui->input_fd);
+ delete_file_handler (input_fd);
}
/* Re-enable stdin after the end of an execution command in
@@ -557,7 +557,7 @@ async_enable_stdin (void)
if (ui->prompt_state == PROMPT_BLOCKED)
{
target_terminal::ours ();
- ui_register_input_event_handler (ui);
+ ui->register_file_handler ();
ui->prompt_state = PROMPT_NEEDED;
}
}
@@ -571,7 +571,7 @@ async_disable_stdin (void)
struct ui *ui = current_ui;
ui->prompt_state = PROMPT_BLOCKED;
- delete_file_handler (ui->input_fd);
+ ui->unregister_file_handler ();
}
@@ -1366,7 +1366,7 @@ gdb_setup_readline (int editing)
Another source is going to be the target program (inferior), but
that must be registered only when it actually exists (I.e. after
we say 'run' or after we connect to a remote target. */
- ui_register_input_event_handler (ui);
+ ui->register_file_handler ();
}
/* Disable command input through the standard CLI channels. Used in
@@ -1393,7 +1393,7 @@ gdb_disable_readline (void)
if (ui->command_editing)
gdb_rl_callback_handler_remove ();
- delete_file_handler (ui->input_fd);
+ ui->unregister_file_handler ();
}
scoped_segv_handler_restore::scoped_segv_handler_restore (segv_handler_t new_handler)