[review] Treat inactive TUI specially in "info win"

Message ID gerrit.1574291000000.Ia860be8c786a71289da6609aa14d86b8365424db@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 20, 2019, 11:03 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/692
......................................................................

Treat inactive TUI specially in "info win"

I noticed that "info win" will print the table header, but no windows,
when the TUI is inactive.  This patch changes this to print a message
instead.

gdb/ChangeLog
2019-11-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_all_windows_info): Treat inactive TUI
	specially.

Change-Id: Ia860be8c786a71289da6609aa14d86b8365424db
---
M gdb/ChangeLog
M gdb/tui/tui-win.c
2 files changed, 11 insertions(+), 0 deletions(-)
  

Comments

Simon Marchi (Code Review) Dec. 1, 2019, 8:17 p.m. UTC | #1
Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/692
......................................................................


Patch Set 1:

I'm checking this in.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cf65de2..be05c9d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-11-20  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-win.c (tui_all_windows_info): Treat inactive TUI
+	specially.
+
 2019-11-19  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-win.c (tui_partial_win_by_name): Move from tui-data.c.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index c8d36c7..20b1fed 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -845,6 +845,12 @@ 
 static void
 tui_all_windows_info (const char *arg, int from_tty)
 {
+  if (!tui_active)
+    {
+      printf_filtered (_("The TUI is not active.\n"));
+      return;
+    }
+
   struct tui_win_info *win_with_focus = tui_win_with_focus ();
   struct ui_out *uiout = current_uiout;