This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gdb: Add new 'layout cli' command.


It always seemed a little strange to me that it's possible to enter
TUI mode by typing commands at the CLI, but to leave TUI mode you need
to know the readline bindings.

This commit adds a new 'layout cli' command to leave tui mode, which
is in addition to the readline bindings.

--

Add a new 'layout cli' command that disables tui mode and returns the
user to cli mode, this is an alternative method of leaving tui mode
which doesn't require knowing the readline bindings.

gdb/ChangeLog:

	* tui/tui-layout.c (_initialize_tui_layout): Add 'cli'
	description.
	(tui_set_layout_by_name): Check for 'cli' choice.
	(layout_completer): Add 'cli' choice.
	* NEWS (New commands): Mention new 'layout cli' command.

gdb/doc/ChangeLog:

	* gdb.texinfo (TUI Commands): Add 'layout cli' details.
---
 gdb/ChangeLog        | 8 ++++++++
 gdb/NEWS             | 3 +++
 gdb/doc/ChangeLog    | 4 ++++
 gdb/doc/gdb.texinfo  | 3 +++
 gdb/tui/tui-layout.c | 8 ++++++--
 5 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 42ef67d..b1c1598 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2015-05-21  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* tui/tui-layout.c (_initialize_tui_layout): Add 'cli'
+	description.
+	(tui_set_layout_by_name): Check for 'cli' choice.
+	(layout_completer): Add 'cli' choice.
+	* NEWS (New commands): Mention new 'layout cli' command.
+
+2015-05-21  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* tui/tui-regs.c (tui_reg_next_command): Use NULL not 0.
 
 2015-05-21  Andrew Burgess  <andrew.burgess@embecosm.com>
diff --git a/gdb/NEWS b/gdb/NEWS
index e08dd0d..1f90a89 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -82,6 +82,9 @@ record bts
 compile print
   Evaluate expression by using the compiler and print result.
 
+layout cli
+  Leave tui mode and return to cli mode.
+
 * New options
 
 set max-completions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index f8b0487..f2699a7 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-21  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.texinfo (TUI Commands): Add 'layout cli' details.
+
 2015-05-16  Doug Evans  <xdje42@gmail.com>
 
 	* guile.texi (Memory Ports in Guile): Document support for unbuffered
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1665372..a78b0bf 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -24967,6 +24967,9 @@ Display the source and assembly window.
 @item layout regs
 Display the register window together with the source or assembly window.
 
+@item layout cli
+Close all windows and return to CLI mode.
+
 @item focus next
 @kindex focus
 Make the next window active for scrolling.
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 0255c39..ed364fb 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -358,7 +358,7 @@ layout_completer (struct cmd_list_element *ignore,
 		  const char *text, const char *word)
 {
   static const char *layout_names [] =
-    { "src", "asm", "split", "regs", "next", "prev", NULL };
+    { "src", "asm", "split", "regs", "cli", "next", "prev", NULL };
 
   return complete_on_enum (layout_names, text, word);
 }
@@ -378,6 +378,7 @@ _initialize_tui_layout (void)
 Change the layout of windows.\n\
 Usage: layout prev | next | <layout_name> \n\
 Layout names are:\n\
+   cli   : Close windows and return to command line.\n\
    src   : Displays source and command windows.\n\
    asm   : Displays disassembly and command windows.\n\
    split : Displays source, disassembly and command windows.\n\
@@ -426,6 +427,8 @@ tui_set_layout_by_name (const char *layout_name)
 	{
 	  if (subset_compare (buf_ptr, "SRC"))
 	    new_layout = SRC_COMMAND;
+	  else if (subset_compare (buf_ptr, "CLI"))
+	    tui_disable ();
 	  else if (subset_compare (buf_ptr, "ASM"))
 	    new_layout = DISASSEM_COMMAND;
 	  else if (subset_compare (buf_ptr, "SPLIT"))
@@ -445,7 +448,8 @@ tui_set_layout_by_name (const char *layout_name)
 	  else
 	    status = TUI_FAILURE;
 
-	  if (status == TUI_SUCCESS)
+	  if (status == TUI_SUCCESS
+	      && new_layout != UNDEFINED_LAYOUT)
 	    {
 	      /* Make sure the curses mode is enabled.  */
 	      tui_enable ();
-- 
2.4.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]