]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/tui/tui.c
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / tui / tui.c
CommitLineData
f377b406 1/* General functions for the WDB TUI.
f33c6cbf 2
1d506c26 3 Copyright (C) 1998-2024 Free Software Foundation, Inc.
f33c6cbf 4
f377b406
SC
5 Contributed by Hewlett-Packard Company.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
f377b406
SC
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c 21
c906108c
SS
22#include "defs.h"
23#include "gdbcmd.h"
d7b2e967 24#include "tui/tui.h"
6a83354a 25#include "tui/tui-hooks.h"
ce38393b 26#include "tui/tui-command.h"
d7b2e967
AC
27#include "tui/tui-data.h"
28#include "tui/tui-layout.h"
29#include "tui/tui-io.h"
30#include "tui/tui-regs.h"
cf2ef009 31#include "tui/tui-status.h"
d7b2e967 32#include "tui/tui-win.h"
45bbae5c 33#include "tui/tui-wingeneral.h"
d7b2e967 34#include "tui/tui-winsource.h"
bfad4537 35#include "tui/tui-source.h"
39db33d6
SC
36#include "target.h"
37#include "frame.h"
38#include "breakpoint.h"
c6f60bcd 39#include "inferior.h"
52575520
EZ
40#include "symtab.h"
41#include "source.h"
3278a9f5 42#include "terminal.h"
ab33ab13 43#include "top.h"
13d03262 44#include "ui.h"
39db33d6 45
479272a3 46#include <ctype.h>
479272a3
JB
47#include <signal.h>
48#include <fcntl.h>
479272a3
JB
49#include <setjmp.h>
50
6a83354a 51#include "gdb_curses.h"
84eda397 52#include "interps.h"
96ec9981 53
7421ccda
AB
54/* See tui.h. */
55
56bool debug_tui = false;
57
58/* Implement 'show debug tui'. */
59
60static void
61show_tui_debug (struct ui_file *file, int from_tty,
62 struct cmd_list_element *c, const char *value)
63{
64 gdb_printf (file, _("TUI debugging is \"%s\".\n"), value);
65}
66
9671aeef
MK
67/* This redefines CTRL if it is not already defined, so it must come
68 after terminal state releated include files like <term.h> and
f9a79064 69 "gdb_curses.h". */
dbda9972 70#include "readline/readline.h"
9671aeef 71
39db33d6 72/* Tells whether the TUI is active or not. */
a1e4dee4
TT
73bool tui_active = false;
74static bool tui_finish_init = true;
39db33d6 75
6d012f14 76enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE;
e09d2eba
SC
77
78struct tui_char_command
79{
80 unsigned char key;
5b6fe301 81 const char *cmd;
e09d2eba
SC
82};
83
1cc6d956
MS
84/* Key mapping to gdb commands when the TUI is using the single key
85 mode. */
e09d2eba
SC
86static const struct tui_char_command tui_commands[] = {
87 { 'c', "continue" },
14a2449e 88 { 'C', "reverse-continue" },
e09d2eba
SC
89 { 'd', "down" },
90 { 'f', "finish" },
14a2449e 91 { 'F', "reverse-finish" },
e09d2eba 92 { 'n', "next" },
14a2449e 93 { 'N', "reverse-next" },
a5afdb16 94 { 'o', "nexti" },
14a2449e 95 { 'O', "reverse-nexti" },
e09d2eba
SC
96 { 'r', "run" },
97 { 's', "step" },
14a2449e 98 { 'S', "reverse-step" },
a5afdb16 99 { 'i', "stepi" },
14a2449e 100 { 'I', "reverse-stepi" },
e09d2eba
SC
101 { 'u', "up" },
102 { 'v', "info locals" },
103 { 'w', "where" },
104 { 0, 0 },
105};
106
107static Keymap tui_keymap;
108static Keymap tui_readline_standard_keymap;
109
110/* TUI readline command.
111 Switch the output mode between TUI/standard gdb. */
39db33d6 112static int
88fa91b4 113tui_rl_switch_mode (int notused1, int notused2)
c906108c 114{
551cb6a5
PA
115
116 /* Don't let exceptions escape. We're in the middle of a readline
117 callback that isn't prepared for that. */
a70b8144 118 try
c906108c 119 {
551cb6a5
PA
120 if (tui_active)
121 {
122 tui_disable ();
123 rl_prep_terminal (0);
124 }
125 else
126 {
127 /* If tui_enable throws, we'll re-prep below. */
128 rl_deprep_terminal ();
129 tui_enable ();
130 }
39db33d6 131 }
96e3f4e3
KB
132 catch (const gdb_exception_forced_quit &ex)
133 {
134 /* Ideally, we'd do a 'throw' here, but as noted above, we can't
135 do that, so, instead, we'll set the necessary flags so that
136 a later QUIT check will restart the forced quit. */
137 set_force_quit_flag ();
138 }
230d2906 139 catch (const gdb_exception &ex)
39db33d6 140 {
551cb6a5
PA
141 exception_print (gdb_stderr, ex);
142
143 if (!tui_active)
144 rl_prep_terminal (0);
c906108c 145 }
c906108c 146
1cc6d956
MS
147 /* Clear the readline in case switching occurred in middle of
148 something. */
39db33d6
SC
149 if (rl_end)
150 rl_kill_text (0, rl_end);
151
152 /* Since we left the curses mode, the terminal mode is restored to
153 some previous state. That state may not be suitable for readline
154 to work correctly (it may be restored in line mode). We force an
1cc6d956
MS
155 exit of the current readline so that readline is re-entered and
156 it will be able to setup the terminal for its needs. By
157 re-entering in readline, we also redisplay its prompt in the
158 non-curses mode. */
39db33d6 159 rl_newline (1, '\n');
c6f60bcd 160
1cc6d956
MS
161 /* Make sure the \n we are returning does not repeat the last
162 command. */
c6f60bcd 163 dont_repeat ();
39db33d6
SC
164 return 0;
165}
c906108c 166
6ba6ffa2
SC
167/* TUI readline command.
168 Change the TUI layout to show a next layout.
377c38ea 169 This function is bound to CTRL-X 2. It is intended to provide
427326a8 170 a functionality close to the Emacs split-window command. */
377c38ea 171static int
88fa91b4 172tui_rl_change_windows (int notused1, int notused2)
377c38ea
SC
173{
174 if (!tui_active)
1cc6d956 175 tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
377c38ea
SC
176
177 if (tui_active)
427326a8 178 tui_next_layout ();
377c38ea 179
377c38ea
SC
180 return 0;
181}
182
6ba6ffa2
SC
183/* TUI readline command.
184 Delete the second TUI window to only show one. */
377c38ea 185static int
88fa91b4 186tui_rl_delete_other_windows (int notused1, int notused2)
377c38ea
SC
187{
188 if (!tui_active)
1cc6d956 189 tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
377c38ea
SC
190
191 if (tui_active)
5afe342e 192 tui_remove_some_windows ();
377c38ea 193
377c38ea
SC
194 return 0;
195}
196
3fc14bdb
SC
197/* TUI readline command.
198 Switch the active window to give the focus to a next window. */
199static int
200tui_rl_other_window (int count, int key)
201{
5b6fe301 202 struct tui_win_info *win_info;
3fc14bdb
SC
203
204 if (!tui_active)
1cc6d956 205 tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
3fc14bdb 206
6ba8e26f
AC
207 win_info = tui_next_win (tui_win_with_focus ());
208 if (win_info)
82a5082e 209 tui_set_win_focus_to (win_info);
3fc14bdb
SC
210 return 0;
211}
212
e09d2eba
SC
213/* TUI readline command.
214 Execute the gdb command bound to the specified key. */
215static int
216tui_rl_command_key (int count, int key)
217{
218 int i;
219
220 reinitialize_more_filter ();
221 for (i = 0; tui_commands[i].cmd; i++)
222 {
223 if (tui_commands[i].key == key)
dda83cd7
SM
224 {
225 /* Insert the command in the readline buffer.
226 Avoid calling the gdb command here since it creates
227 a possible recursion on readline if prompt_for_continue
228 is called (See PR 9584). The command will also appear
229 in the readline history which turns out to be better. */
230 rl_insert_text (tui_commands[i].cmd);
231 rl_newline (1, '\n');
232
233 /* Switch to gdb command mode while executing the command.
33b5899f 234 This way the gdb's continue prompt will be displayed. */
dda83cd7
SM
235 tui_set_key_mode (TUI_ONE_COMMAND_MODE);
236 return 0;
237 }
e09d2eba
SC
238 }
239 return 0;
240}
241
242/* TUI readline command.
243 Temporarily leave the TUI SingleKey mode to allow editing
244 a gdb command with the normal readline. Once the command
245 is executed, the TUI SingleKey mode is installed back. */
246static int
247tui_rl_command_mode (int count, int key)
248{
6d012f14 249 tui_set_key_mode (TUI_ONE_COMMAND_MODE);
e09d2eba
SC
250 return rl_insert (count, key);
251}
252
253/* TUI readline command.
254 Switch between TUI SingleKey mode and gdb readline editing. */
255static int
88fa91b4 256tui_rl_next_keymap (int notused1, int notused2)
e09d2eba 257{
3fc14bdb 258 if (!tui_active)
1cc6d956 259 tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
3fc14bdb 260
68bb2e3e
TV
261 if (rl_end)
262 {
263 rl_end = 0;
264 rl_point = 0;
265 rl_mark = 0;
266 }
267
6d012f14 268 tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
dda83cd7 269 ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
e09d2eba
SC
270 return 0;
271}
272
273/* Readline hook to redisplay ourself the gdb prompt.
274 In the SingleKey mode, the prompt is not printed so that
275 the command window is cleaner. It will be displayed if
276 we temporarily leave the SingleKey mode. */
277static int
d02c80cd 278tui_rl_startup_hook (void)
e09d2eba 279{
ab33ab13 280 if (tui_current_key_mode != TUI_COMMAND_MODE
dbf30ca3 281 && !gdb_in_secondary_prompt_p (current_ui))
6d012f14 282 tui_set_key_mode (TUI_SINGLE_KEY_MODE);
e09d2eba
SC
283 return 0;
284}
285
1cc6d956
MS
286/* Change the TUI key mode by installing the appropriate readline
287 keymap. */
e09d2eba
SC
288void
289tui_set_key_mode (enum tui_key_mode mode)
290{
291 tui_current_key_mode = mode;
6d012f14 292 rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
dda83cd7 293 ? tui_keymap : tui_readline_standard_keymap);
e0dd0e4d 294 tui_show_status_content ();
e09d2eba
SC
295}
296
39db33d6
SC
297/* Initialize readline and configure the keymap for the switching
298 key shortcut. */
c906108c 299void
a350efd4 300tui_ensure_readline_initialized ()
c906108c 301{
a350efd4
TT
302 static bool initialized;
303
304 if (initialized)
305 return;
306 initialized = true;
307
e09d2eba
SC
308 int i;
309 Keymap tui_ctlx_keymap;
310
6ba6ffa2 311 rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);
e09d2eba 312 rl_add_defun ("next-keymap", tui_rl_next_keymap, -1);
c86d74cc
TT
313 rl_add_defun ("tui-delete-other-windows", tui_rl_delete_other_windows, -1);
314 rl_add_defun ("tui-change-windows", tui_rl_change_windows, -1);
315 rl_add_defun ("tui-other-window", tui_rl_other_window, -1);
e09d2eba
SC
316
317 tui_keymap = rl_make_bare_keymap ();
11061048
TT
318
319 /* The named keymap feature was added in Readline 8.0. */
320#if RL_READLINE_VERSION >= 0x800
321 rl_set_keymap_name ("SingleKey", tui_keymap);
322#endif
323
e09d2eba
SC
324 tui_ctlx_keymap = rl_make_bare_keymap ();
325 tui_readline_standard_keymap = rl_get_keymap ();
326
327 for (i = 0; tui_commands[i].cmd; i++)
328 rl_bind_key_in_map (tui_commands[i].key, tui_rl_command_key, tui_keymap);
329
330 rl_generic_bind (ISKMAP, "\\C-x", (char*) tui_ctlx_keymap, tui_keymap);
331
332 /* Bind all other keys to tui_rl_command_mode so that we switch
333 temporarily from SingleKey mode and can enter a gdb command. */
e3da6fc5 334 for (i = ' '; i < 0x7f; i++)
e09d2eba
SC
335 {
336 int j;
337
338 for (j = 0; tui_commands[j].cmd; j++)
dda83cd7
SM
339 if (tui_commands[j].key == i)
340 break;
e09d2eba
SC
341
342 if (tui_commands[j].cmd)
dda83cd7 343 continue;
e09d2eba
SC
344
345 rl_bind_key_in_map (i, tui_rl_command_mode, tui_keymap);
346 }
347
6ba6ffa2 348 rl_bind_key_in_map ('a', tui_rl_switch_mode, emacs_ctlx_keymap);
e09d2eba 349 rl_bind_key_in_map ('a', tui_rl_switch_mode, tui_ctlx_keymap);
6ba6ffa2 350 rl_bind_key_in_map ('A', tui_rl_switch_mode, emacs_ctlx_keymap);
e09d2eba 351 rl_bind_key_in_map ('A', tui_rl_switch_mode, tui_ctlx_keymap);
6ba6ffa2 352 rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, emacs_ctlx_keymap);
e09d2eba 353 rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, tui_ctlx_keymap);
6ba6ffa2 354 rl_bind_key_in_map ('1', tui_rl_delete_other_windows, emacs_ctlx_keymap);
e09d2eba 355 rl_bind_key_in_map ('1', tui_rl_delete_other_windows, tui_ctlx_keymap);
6ba6ffa2 356 rl_bind_key_in_map ('2', tui_rl_change_windows, emacs_ctlx_keymap);
e09d2eba 357 rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap);
3fc14bdb
SC
358 rl_bind_key_in_map ('o', tui_rl_other_window, emacs_ctlx_keymap);
359 rl_bind_key_in_map ('o', tui_rl_other_window, tui_ctlx_keymap);
e09d2eba
SC
360 rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap);
361 rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap);
362 rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap);
a350efd4
TT
363
364 /* Initialize readline after the above. */
365 rl_initialize ();
39db33d6 366}
c906108c 367
84eda397
PA
368/* Return the TERM variable from the environment, or "<unset>"
369 if not set. */
370
371static const char *
372gdb_getenv_term (void)
373{
374 const char *term;
375
376 term = getenv ("TERM");
377 if (term != NULL)
378 return term;
379 return "<unset>";
380}
381
39db33d6
SC
382/* Enter in the tui mode (curses).
383 When in normal mode, it installs the tui hooks in gdb, redirects
384 the gdb output, configures the readline to work in tui mode.
385 When in curses mode, it does nothing. */
c906108c 386void
39db33d6 387tui_enable (void)
c906108c 388{
7421ccda
AB
389 TUI_SCOPED_DEBUG_ENTER_EXIT;
390
39db33d6
SC
391 if (tui_active)
392 return;
393
30baf67b 394 /* To avoid to initialize curses when gdb starts, there is a deferred
39db33d6
SC
395 curses initialization. This initialization is made only once
396 and the first time the curses mode is entered. */
397 if (tui_finish_init)
c906108c 398 {
39db33d6 399 WINDOW *w;
84eda397 400 SCREEN *s;
a6a4b2c6
EZ
401#ifndef __MINGW32__
402 const char *cap;
403#endif
84eda397
PA
404 const char *interp;
405
406 /* If the top level interpreter is not the console/tui (e.g.,
407 MI), enabling curses will certainly lose. */
d525a99b 408 interp = top_level_interpreter ()->name ();
84eda397
PA
409 if (strcmp (interp, INTERP_TUI) != 0)
410 error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
411
412 /* Don't try to setup curses (and print funny control
413 characters) if we're not outputting to a terminal. */
da5bd37e 414 if (!gdb_stderr->isatty ())
84eda397
PA
415 error (_("Cannot enable the TUI when output is not a terminal"));
416
c87e6d00 417 s = newterm (NULL, stdout, stdin);
6b8a872f
EZ
418#ifdef __MINGW32__
419 /* The MinGW port of ncurses requires $TERM to be unset in order
420 to activate the Windows console driver. */
421 if (s == NULL)
adf3dde5 422 s = newterm ((char *) "unknown", stdout, stdin);
6b8a872f 423#endif
84eda397
PA
424 if (s == NULL)
425 {
426 error (_("Cannot enable the TUI: error opening terminal [TERM=%s]"),
427 gdb_getenv_term ());
428 }
429 w = stdscr;
1d1d0bf7
TT
430 if (has_colors ())
431 {
432#ifdef HAVE_USE_DEFAULT_COLORS
433 /* Ncurses extension to help with resetting to the default
434 color. */
435 use_default_colors ();
436#endif
437 start_color ();
438 }
84eda397 439
6b8a872f
EZ
440 /* Check required terminal capabilities. The MinGW port of
441 ncurses does have them, but doesn't expose them through "cup". */
442#ifndef __MINGW32__
a121b7c1 443 cap = tigetstr ((char *) "cup");
84eda397
PA
444 if (cap == NULL || cap == (char *) -1 || *cap == '\0')
445 {
446 endwin ();
447 delscreen (s);
448 error (_("Cannot enable the TUI: "
449 "terminal doesn't support cursor addressing [TERM=%s]"),
450 gdb_getenv_term ());
451 }
6b8a872f 452#endif
39db33d6 453
29db1eb3
AB
454 /* We must mark the tui sub-system active before trying to setup the
455 current layout as tui windows defined by an extension language
456 rely on this flag being true in order to know that the window
457 they are creating is currently valid. */
458 tui_active = true;
459
377c38ea
SC
460 cbreak ();
461 noecho ();
1cc6d956 462 /* timeout (1); */
39db33d6
SC
463 nodelay(w, FALSE);
464 nl();
465 keypad (w, TRUE);
dd1abb8c
AC
466 tui_set_term_height_to (LINES);
467 tui_set_term_width_to (COLS);
39db33d6
SC
468 def_prog_mode ();
469
47d3492a 470 tui_show_frame_info (0);
416eb92d 471 tui_set_initial_layout ();
6d012f14 472 tui_set_win_focus_to (TUI_SRC_WIN);
7523da63
TT
473 keypad (TUI_CMD_WIN->handle.get (), TRUE);
474 wrefresh (TUI_CMD_WIN->handle.get ());
a1e4dee4 475 tui_finish_init = false;
c906108c 476 }
39db33d6
SC
477 else
478 {
29db1eb3
AB
479 /* Save the current gdb setting of the terminal.
480 Curses will restore this state when endwin() is called. */
481 def_shell_mode ();
482 clearok (stdscr, TRUE);
483
484 tui_active = true;
485 }
486
487 gdb_assert (tui_active);
c906108c 488
484c9b64
TT
489 if (tui_update_variables ())
490 tui_rehighlight_all ();
491
39db33d6 492 tui_setup_io (1);
c906108c 493
f8e5e23e
PA
494 /* Resize windows before anything might display/refresh a
495 window. */
fc6b1256
PP
496 if (tui_win_resized ())
497 {
9abd8a65 498 tui_set_win_resized_to (false);
1e04046d 499 tui_resize_all ();
fc6b1256 500 }
f8e5e23e 501
b2efe70c
AB
502 /* Install the TUI specific hooks. This must be done after the call to
503 tui_display_main so that we don't detect the symtab changed event it
504 can cause. */
505 tui_install_hooks ();
506 rl_startup_hook = tui_rl_startup_hook;
507
f8e5e23e
PA
508 /* Restore TUI keymap. */
509 tui_set_key_mode (tui_current_key_mode);
510
511 /* Refresh the screen. */
a21fcd8f 512 tui_refresh_all_win ();
1533ce99
SC
513
514 /* Update gdb's knowledge of its terminal. */
3278a9f5 515 gdb_save_tty_state ();
3e752b04 516 tui_update_gdb_sizes ();
39db33d6
SC
517}
518
519/* Leave the tui mode.
520 Remove the tui hooks and configure the gdb output and readline
521 back to their original state. The curses mode is left so that
522 the terminal setting is restored to the point when we entered. */
c906108c 523void
39db33d6 524tui_disable (void)
c906108c 525{
7421ccda
AB
526 TUI_SCOPED_DEBUG_ENTER_EXIT;
527
39db33d6
SC
528 if (!tui_active)
529 return;
c906108c 530
e3da6fc5
SC
531 /* Restore initial readline keymap. */
532 rl_set_keymap (tui_readline_standard_keymap);
533
39db33d6
SC
534 /* Remove TUI hooks. */
535 tui_remove_hooks ();
e09d2eba
SC
536 rl_startup_hook = 0;
537 rl_already_prompted = 0;
c906108c 538
1bace02a
HD
539#ifdef NCURSES_MOUSE_VERSION
540 mousemask (0, NULL);
541#endif
542
39db33d6
SC
543 /* Leave curses and restore previous gdb terminal setting. */
544 endwin ();
c906108c 545
39db33d6
SC
546 /* gdb terminal has changed, update gdb internal copy of it
547 so that terminal management with the inferior works. */
548 tui_setup_io (0);
c906108c 549
1533ce99 550 /* Update gdb's knowledge of its terminal. */
3278a9f5 551 gdb_save_tty_state ();
1533ce99 552
a1e4dee4 553 tui_active = false;
3e752b04 554 tui_update_gdb_sizes ();
39db33d6 555}
c906108c 556
a4ea0946
AB
557/* Command wrapper for enabling tui mode. */
558
559static void
b961da0b 560tui_enable_command (const char *args, int from_tty)
a4ea0946
AB
561{
562 tui_enable ();
563}
564
565/* Command wrapper for leaving tui mode. */
566
567static void
b961da0b 568tui_disable_command (const char *args, int from_tty)
a4ea0946
AB
569{
570 tui_disable ();
571}
572
1403b519 573void
13274fc3 574tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr)
1403b519 575{
45bbae5c 576 tui_suppress_output suppress;
080ce8c0 577 tui_add_win_to_layout (DISASSEM_WIN);
13274fc3 578 tui_update_source_windows_with_addr (gdbarch, addr);
1403b519
SC
579}
580
56122977 581bool
22940a24 582tui_is_window_visible (enum tui_win_type type)
1403b519 583{
a1e4dee4 584 if (!tui_active)
56122977 585 return false;
1403b519 586
5a11fff0 587 if (tui_win_list[type] == nullptr)
56122977 588 return false;
5a11fff0 589
2d83e710 590 return tui_win_list[type]->is_visible ();
1403b519
SC
591}
592
87d557ae 593bool
08ef48c5
MS
594tui_get_command_dimension (unsigned int *width,
595 unsigned int *height)
1403b519 596{
6d012f14 597 if (!tui_active || (TUI_CMD_WIN == NULL))
87d557ae 598 return false;
1403b519 599
cb2ce893
TT
600 *width = TUI_CMD_WIN->width;
601 *height = TUI_CMD_WIN->height;
87d557ae 602 return true;
1403b519 603}
a4ea0946 604
6c265988 605void _initialize_tui ();
a4ea0946 606void
6c265988 607_initialize_tui ()
a4ea0946
AB
608{
609 struct cmd_list_element **tuicmd;
610
611 tuicmd = tui_get_cmd_list ();
612
613 add_cmd ("enable", class_tui, tui_enable_command,
283be8bf
TT
614 _("Enable TUI display mode.\n\
615Usage: tui enable"),
a4ea0946
AB
616 tuicmd);
617 add_cmd ("disable", class_tui, tui_disable_command,
283be8bf
TT
618 _("Disable TUI display mode.\n\
619Usage: tui disable"),
a4ea0946 620 tuicmd);
7421ccda
AB
621
622 /* Debug this tui internals. */
623 add_setshow_boolean_cmd ("tui", class_maintenance, &debug_tui, _("\
624Set tui debugging."), _("\
625Show tui debugging."), _("\
626When true, tui specific internal debugging is enabled."),
627 NULL,
628 show_tui_debug,
629 &setdebuglist, &showdebuglist);
a4ea0946 630}