diff options
Diffstat (limited to 'gdb/tui/tui-interp.c')
-rw-r--r-- | gdb/tui/tui-interp.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 3bb8246..2a6c3ce 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -45,11 +45,16 @@ tui_exit (void) tui_disable (); } +/* True if TUI is the top-level interpreter. */ +static int tui_is_toplevel = 0; + /* These implement the TUI interpreter. */ static void * tui_init (int top_level) { + tui_is_toplevel = top_level; + /* Install exit handler to leave the screen in a good shape. */ atexit (tui_exit); @@ -63,6 +68,18 @@ tui_init (int top_level) return NULL; } +/* True if enabling the TUI is allowed. Example, if the top level + interpreter is MI, enabling curses will certainly lose. */ + +int +tui_allowed_p (void) +{ + /* Only if TUI is the top level interpreter. Also don't try to + setup curses (and print funny control characters) if we're not + outputting to a terminal. */ + return tui_is_toplevel && ui_file_isatty (gdb_stdout); +} + static int tui_resume (void *data) { |