aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:51 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:51 +0100
commitb2d86570b316c347384c4ba9bb3933ed5e807fca (patch)
tree28b5d6a9bf5fa7a41e0cfb3de98dd5583732c596 /gdb/mi
parent9204d6922cb80f34dd799e57f7f0c74bc86e7027 (diff)
downloadgdb-b2d86570b316c347384c4ba9bb3933ed5e807fca.zip
gdb-b2d86570b316c347384c4ba9bb3933ed5e807fca.tar.gz
gdb-b2d86570b316c347384c4ba9bb3933ed5e807fca.tar.bz2
Simplify starting the command event loop
All interpreter types (CLI/TUI/MI) print the prompt, and then call start_event_loop. Because we'll need an interpreter hook to display the interpreter-specific prompt before going back to the event loop, without actually starting an event loop, this patch moves the start_event_loop call to common code, and replaces the command_loop hook with a pre_command_look hook, that now just prints the prompt. Turns out to be a cleanup on its own right anyway. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interpreter_pre_command_loop): New function. (cli_interp_procs): Install it instead of cli_command_loop. * cli/cli-interp.h (cli_interpreter_pre_command_loop): Declare. * event-top.c (cli_command_loop): Delete. * interps.c (interp_new): Remove reference to command_loop_proc. (current_interp_command_loop): Delete. (interp_pre_command_loop): New function. (interp_command_loop_ftype): Delete. * interps.h (interp_pre_command_loop_ftype): New typedef. (struct interp_procs) <command_loop_proc>: Delele field. <pre_command_loop_proc>: New field. (current_interp_command_loop): Delete declaration. (interp_pre_command_loop): New declaration. * main.c (captured_command_loop): Call interp_pre_command_loop instead of current_interp_command_loop and start an event loop. * mi/mi-interp.c (mi_command_loop): Delete. (mi_interpreter_pre_command_loop): New. (mi_interp_procs): Update. * tui/tui-interp.c (tui_interp_procs): Install cli_interpreter_pre_command_loop instead of cli_command_loop.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-interp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 63f05c3..4376ffa 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -44,7 +44,6 @@
static void mi_execute_command_wrapper (const char *cmd);
static void mi_execute_command_input_handler (char *cmd);
-static void mi_command_loop (void *data);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the MI's
@@ -329,9 +328,9 @@ mi_execute_command_input_handler (char *cmd)
}
static void
-mi_command_loop (void *data)
+mi_interpreter_pre_command_loop (struct interp *self)
{
- struct mi_interp *mi = (struct mi_interp *) data;
+ struct mi_interp *mi = (struct mi_interp *) interp_data (self);
/* Turn off 8 bit strings in quoted output. Any character with the
high bit set is printed using C's octal format. */
@@ -339,8 +338,6 @@ mi_command_loop (void *data)
/* Tell the world that we're alive. */
display_mi_prompt (mi);
-
- start_event_loop ();
}
static void
@@ -1442,7 +1439,7 @@ static const struct interp_procs mi_interp_procs =
mi_interpreter_exec, /* exec_proc */
mi_ui_out, /* ui_out_proc */
mi_set_logging, /* set_logging_proc */
- mi_command_loop /* command_loop_proc */
+ mi_interpreter_pre_command_loop /* pre_command_loop_proc */
};
/* Factory for MI interpreters. */