From patchwork Thu May 21 22:06:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 6857 Received: (qmail 87161 invoked by alias); 21 May 2015 22:06:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 87134 invoked by uid 89); 21 May 2015 22:06:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 21 May 2015 22:06:40 +0000 Received: by wicmc15 with SMTP id mc15so25427559wic.1 for ; Thu, 21 May 2015 15:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8Wb+PHRQq4eW8XK8aoxAOMzqf9AD0g1BLjrBxLAE0uc=; b=PhqMVcw9vYQaZkmgryyTfvizh7BSQHkfD5h9Na66GvQr2aPXbOBp3p1COUxbGTnppM BN/9y8I2DuyWLklbAbcBxDaEE1SrPcgEjEjVO1g9CIVHPsKZRsLtnCmFO+12OhFsJ0X2 4+jb46KcJimn3Ww/I5oUg8EkXm/P9PBsVJBG0HBrgCOmalT72+O87XRlD8+1h5vu2j5W IOIKWRKwXNxe7yP8EJzzacvciDj1V2CNvmrdNGzsNsYTG7i2iBwT8bxr+dDJPkbiWOAF C51dx9BHexm/6nIkLwMSuyJkwMwrdpq8YQvd2HVbISvz7rFOsmWaoernV4n052odqE7F vuSw== X-Gm-Message-State: ALoCoQnL1cOAjkVKG0S0I8zkIv2qvczr6WtQTPkR/kXNsKEgxqGJRFZ3UIpSt+opxbbujf6sRxKY X-Received: by 10.194.179.67 with SMTP id de3mr8897498wjc.77.1432245997364; Thu, 21 May 2015 15:06:37 -0700 (PDT) Received: from localhost ([46.189.28.189]) by mx.google.com with ESMTPSA id f8sm4579968wiy.7.2015.05.21.15.06.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 15:06:36 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: Add new 'layout cli' command. Date: Fri, 22 May 2015 00:06:25 +0200 Message-Id: X-IsSubscribed: yes 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 + * 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 + * tui/tui-regs.c (tui_reg_next_command): Use NULL not 0. 2015-05-21 Andrew Burgess 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 + + * gdb.texinfo (TUI Commands): Add 'layout cli' details. + 2015-05-16 Doug Evans * 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 | \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 ();