diff options
Diffstat (limited to 'gdb/tui/tui-interp.c')
-rw-r--r-- | gdb/tui/tui-interp.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 7a0da482e3c..75445001233 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -138,6 +138,9 @@ tui_init (struct interp *self, int top_level) /* Install exit handler to leave the screen in a good shape. */ atexit (tui_exit); + if (top_level) + tui_interp = self; + tui_initialize_static_data (); tui_initialize_io (); @@ -207,25 +210,34 @@ tui_exec (void *data, const char *command_str) internal_error (__FILE__, __LINE__, _("tui_exec called")); } +/* The TUI interpreter's vtable. */ + +static const struct interp_procs tui_interp_procs = { + tui_init, + tui_resume, + tui_suspend, + tui_exec, + tui_ui_out, + NULL, + cli_command_loop +}; + +/* Factory for TUI interpreters. */ + +static struct interp * +tui_interp_factory (const char *name) +{ + return interp_new (name, &tui_interp_procs, NULL); +} + /* Provide a prototype to silence -Wmissing-prototypes. */ extern initialize_file_ftype _initialize_tui_interp; void _initialize_tui_interp (void) { - static const struct interp_procs procs = { - tui_init, - tui_resume, - tui_suspend, - tui_exec, - tui_ui_out, - NULL, - cli_command_loop - }; - - /* Create a default uiout builder for the TUI. */ - tui_interp = interp_new (INTERP_TUI, &procs); - interp_add (tui_interp); + interp_factory_register (INTERP_TUI, tui_interp_factory); + if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0) tui_start_enabled = 1; |