Give every interpreter a command_loop_proc.

https://sourceware.org/ml/gdb-patches/2013-09/msg00179.html

gdb/ChangeLog

        * cli/cli-interp.c (_initialize_cli_interp): Add a
        command_loop_proc to interp_procs.
        * event-top.c (cli_command_loop): Change signature to match
        interp_command_loop_ftype.
        * event-top.h (cli_command_loop): Same.
        * interps.c (interp_new): Require every interpreter to have a
        command_loop_proc.
        (current_interp_command_loop): Just call the command_loop_proc on
        the current interpreter.
        * tui/tui-interp.c (_initialize_tui_interp): Add a
        command_loop_proc to interp_procs.
This commit is contained in:
Andrew Burgess
2013-09-06 08:53:09 +00:00
parent 8eb3d7b6ca
commit 4d09c5b423
6 changed files with 30 additions and 11 deletions

View File

@@ -101,6 +101,9 @@ interp_new (const char *name, const struct interp_procs *procs)
new_interp->procs = procs;
new_interp->inited = 0;
/* Check for required procs. */
gdb_assert (procs->command_loop_proc != NULL);
return new_interp;
}
@@ -319,13 +322,9 @@ current_interp_display_prompt_p (void)
void
current_interp_command_loop (void)
{
/* Somewhat messy. For the moment prop up all the old ways of
selecting the command loop. */
if (current_interpreter != NULL
&& current_interpreter->procs->command_loop_proc != NULL)
current_interpreter->procs->command_loop_proc (current_interpreter->data);
else
cli_command_loop ();
gdb_assert (current_interpreter != NULL);
current_interpreter->procs->command_loop_proc (current_interpreter->data);
}
int