aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:44 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:44 +0100
commita74e1786ac24d4ef1ce8a92a1ab06c727a462881 (patch)
tree0029ac9cc3ec060349bb6d98a56423db4df820dd /gdb/top.c
parent45db7c09c37c9aceb3a7e149a6577388fc566432 (diff)
downloadgdb-a74e1786ac24d4ef1ce8a92a1ab06c727a462881.zip
gdb-a74e1786ac24d4ef1ce8a92a1ab06c727a462881.tar.gz
gdb-a74e1786ac24d4ef1ce8a92a1ab06c727a462881.tar.bz2
Introduce "struct ui"
This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/top.c b/gdb/top.c
index f5ef718..cae90d6 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -794,13 +794,14 @@ struct gdb_readline_wrapper_cleanup
static void
gdb_readline_wrapper_cleanup (void *arg)
{
+ struct ui *ui = current_ui;
struct gdb_readline_wrapper_cleanup *cleanup
= (struct gdb_readline_wrapper_cleanup *) arg;
rl_already_prompted = cleanup->already_prompted_orig;
- gdb_assert (input_handler == gdb_readline_wrapper_line);
- input_handler = cleanup->handler_orig;
+ gdb_assert (ui->input_handler == gdb_readline_wrapper_line);
+ ui->input_handler = cleanup->handler_orig;
/* Don't restore our input handler in readline yet. That would make
readline prep the terminal (putting it in raw mode), while the
@@ -826,13 +827,14 @@ gdb_readline_wrapper_cleanup (void *arg)
char *
gdb_readline_wrapper (const char *prompt)
{
+ struct ui *ui = current_ui;
struct cleanup *back_to;
struct gdb_readline_wrapper_cleanup *cleanup;
char *retval;
cleanup = XNEW (struct gdb_readline_wrapper_cleanup);
- cleanup->handler_orig = input_handler;
- input_handler = gdb_readline_wrapper_line;
+ cleanup->handler_orig = ui->input_handler;
+ ui->input_handler = gdb_readline_wrapper_line;
cleanup->already_prompted_orig = rl_already_prompted;