From b2d86570b316c347384c4ba9bb3933ed5e807fca Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 21 Jun 2016 01:11:51 +0100 Subject: 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 * 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) : Delele field. : 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. --- gdb/cli/cli-interp.c | 10 +++++++++- gdb/cli/cli-interp.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index e5d23b5..40cbe35 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -190,6 +190,14 @@ cli_on_command_error (void) display_gdb_prompt (NULL); } +/* pre_command_loop implementation. */ + +void +cli_interpreter_pre_command_loop (struct interp *self) +{ + display_gdb_prompt (0); +} + /* These implement the cli out interpreter: */ static void * @@ -312,7 +320,7 @@ static const struct interp_procs cli_interp_procs = { cli_interpreter_exec, /* exec_proc */ cli_ui_out, /* ui_out_proc */ NULL, /* set_logging_proc */ - cli_command_loop, /* command_loop_proc */ + cli_interpreter_pre_command_loop, /* pre_command_loop_proc */ cli_interpreter_supports_command_editing, /* supports_command_editing_proc */ }; diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h index 07b7505..85be118 100644 --- a/gdb/cli/cli-interp.h +++ b/gdb/cli/cli-interp.h @@ -22,4 +22,6 @@ struct interp; extern int cli_interpreter_supports_command_editing (struct interp *interp); +extern void cli_interpreter_pre_command_loop (struct interp *self); + #endif -- cgit v1.1