From patchwork Fri May 22 08:19:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 6884 Received: (qmail 6805 invoked by alias); 22 May 2015 08:19:22 -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 6793 invoked by uid 89); 22 May 2015 08:19:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 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-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 22 May 2015 08:19:20 +0000 Received: by wicmx19 with SMTP id mx19so33621810wic.0 for ; Fri, 22 May 2015 01:19:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=k7JvijlIZfjexPqzizXAnhnBKEo3m50XUIAppyXPt7s=; b=bdtldNQFBDIGAf7KNqXB+QsrUzYqpfizJZ4K4esaHgAgQcXayRxtBciJ01UQ0n2xH1 D/4MM81OcrE30s1hGYa7+ZtW4qczK6V6t5BkWraE8MVp9niCfwDCzNkjOn2qphZQzrIZ dm68Lv8l5QyWpSuwvhJIdTbUAd71r9A/zHcuL1uMJjYiabEpvN+12GDdZD4P+XiHZjhG xYseIPhoXczo10xl+dEHFbj4A7Pau/fYrf6AyPMNr63h61Odz8tvrtyi6ZJJb/4vTD3W g8asePhuvhV/xoCyAwWt+5rKb9SeWi0INzC6sjIgPZYfyb/d3KkOiWgzkfVxADOEU6D9 iheQ== X-Gm-Message-State: ALoCoQmuHmbKrtQX4NkDiOcACBk52L+UFXsPztAL3CO5VkU9Zp/gW1zczyu9wZUCLrZJP323K5xg X-Received: by 10.194.7.97 with SMTP id i1mr5018941wja.107.1432282757564; Fri, 22 May 2015 01:19:17 -0700 (PDT) Received: from localhost (TK158115.telekabel.at. [195.34.158.115]) by mx.google.com with ESMTPSA id bh7sm2017115wjb.8.2015.05.22.01.19.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 01:19:16 -0700 (PDT) Date: Fri, 22 May 2015 10:19:15 +0200 From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Pedro Alves , Eli Zaretskii Subject: Re: [PATCH] gdb: Add new 'layout cli' command. Message-ID: <20150522081915.GK2880@embecosm.com> References: <555E785D.60703@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <555E785D.60703@redhat.com> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes * Pedro Alves [2015-05-22 01:29:17 +0100]: > I notice that we have no blessed way to go back to the same layout that > was current when the tui was last active. "layout current" would be odd, > given that the current is "cli"... Hmm, "layout last" (like "cd -")? > Not sure... > > A separate command ("tui enable/disable"? "set tui enabled on/off"?) > would be a more direct mapping to the readline bindings. I'm happy with that. As a bonus this solves the above problem too, so 'tui enable' returns to the last active layout. Eli, sorry, this revision renders your last doc review redundant. Thanks, Andrew --- Add new commands to specifically enable and disable tui mode. This is in addition to the readline bindings, but might be easier for a user to discover if they accidentally end up in tui mode. gdb/ChangeLog: * NEWS: Mention 'tui enable' and 'tui disable'. * tui/tui.c (tui_enable_command): New function. (tui_disable_command): New function. (_initialize_tui): New function. gdb/doc/ChangeLog: * gdb.texinfo (TUI): Include 'tui enable' in the introduction. (TUI Commands): Add 'tui enable' and 'tui disable' details. --- gdb/ChangeLog | 7 +++++++ gdb/NEWS | 4 ++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 15 +++++++++++++-- gdb/tui/tui.c | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 42ef67d..f55b9c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-05-22 Andrew Burgess + + * NEWS: Mention 'tui enable' and 'tui disable'. + * tui/tui.c (tui_enable_command): New function. + (tui_disable_command): New function. + (_initialize_tui): New function. + 2015-05-21 Andrew Burgess * tui/tui-regs.c (tui_reg_next_command): Use NULL not 0. diff --git a/gdb/NEWS b/gdb/NEWS index e08dd0d..745444b 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -82,6 +82,10 @@ record bts compile print Evaluate expression by using the compiler and print result. +tui enable +tui disable + Explicit commands for enabling and disabling tui mode. + * New options set max-completions diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f8b0487..445f64d 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2015-05-22 Andrew Burgess + + * gdb.texinfo (TUI): Include 'tui enable' in the introduction. + (TUI Commands): Add 'tui enable' and 'tui disable' 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..e38fd31 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -24669,8 +24669,9 @@ is available. The TUI mode is enabled by default when you invoke @value{GDBN} as @samp{@value{GDBP} -tui}. You can also switch in and out of TUI mode while @value{GDBN} runs by -using various TUI commands and key bindings, such as @kbd{C-x C-a}. -@xref{TUI Keys, ,TUI Key Bindings}. +using various TUI commands and key bindings, such as @command{tui +enable} or @kbd{C-x C-a}. @xref{TUI Commands, ,TUI Commands} and +@ref{TUI Keys, ,TUI Key Bindings}. @node TUI Overview @section TUI Overview @@ -24944,6 +24945,16 @@ these commands will fail with an error, because it would not be possible or desirable to enable curses window management. @table @code +@item tui enable +@kindex tui enable +Activate TUI mode. The last active TUI window layout will be used if +TUI mode has prevsiouly been used in the current debugging session, +otherwise a default layout is used. + +@item tui disable +@kindex tui disable +Disable TUI mode, returning to the console interpreter. + @item info win @kindex info win List and give the size of all displayed windows. diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 308e7ae..838471d 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -540,6 +540,22 @@ tui_disable (void) tui_update_gdb_sizes (); } +/* Command wrapper for enabling tui mode. */ + +static void +tui_enable_command (char *args, int from_tty) +{ + tui_enable (); +} + +/* Command wrapper for leaving tui mode. */ + +static void +tui_disable_command (char *args, int from_tty) +{ + tui_disable (); +} + void strcat_to_buf (char *buf, int buflen, const char *item_to_add) @@ -652,3 +668,21 @@ tui_get_command_dimension (unsigned int *width, *height = TUI_CMD_WIN->generic.height; return 1; } + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern initialize_file_ftype _initialize_tui; + +void +_initialize_tui (void) +{ + struct cmd_list_element **tuicmd; + + tuicmd = tui_get_cmd_list (); + + add_cmd ("enable", class_tui, tui_enable_command, + _("Enable TUI display mode."), + tuicmd); + add_cmd ("disable", class_tui, tui_disable_command, + _("Disable TUI display mode."), + tuicmd); +}