From patchwork Wed May 20 23:17:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 6841 Received: (qmail 127358 invoked by alias); 20 May 2015 23:18:17 -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 127278 invoked by uid 89); 20 May 2015 23:18:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wg0-f44.google.com Received: from mail-wg0-f44.google.com (HELO mail-wg0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 20 May 2015 23:18:14 +0000 Received: by wghq2 with SMTP id q2so68184254wgh.1 for ; Wed, 20 May 2015 16:18:12 -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:in-reply-to :references:in-reply-to:references; bh=p+nEFx2FxFo/kLIGnrnFQox4UVn3t2WRMAMKynEgIVc=; b=M1dO+keZPZxlwQ9WcNiFk8q39QneLH+nbnct9VFLEp2BwGsMu2oiIqaE/id4QHeK3X TNtvjl9bNwHfoUFSThtDz9JgfzTUvpktRQt7uiA/xxjfhjLWv4KZI1NwKhaemV1nLBWK mJFJ1trlf+cLQcKeUtakKl6T2biaO44/n8ho912vmP8G8zYuYr4V8862yIvSn444pKkY nS7uDarDGlPrJ8G1vfD9Jv1HuttjhL+IMB8CJzp+YIKQkm2dRDGJsIUn/jodi64KxxBV BU6F8bC7/ShAB3Q739wXrGJzBAl9MB86CI+24leC7jBe6b0kJCJq/2swjOZhRuJki19V 6mMQ== X-Gm-Message-State: ALoCoQnFBbjcgM0Us8lSDbk9G0hGTdRGgS8Jg/NtFeFXjopEHcvy8896uOdeae6Lo12NF2jZbkPx X-Received: by 10.194.58.11 with SMTP id m11mr70239213wjq.92.1432163892065; Wed, 20 May 2015 16:18:12 -0700 (PDT) Received: from localhost ([46.189.28.220]) by mx.google.com with ESMTPSA id u9sm29128091wjx.15.2015.05.20.16.18.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 16:18:11 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 3/4] gdb: Don't call tui_enable too early. Date: Thu, 21 May 2015 01:17:30 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Calling tui_enable too early in tui_layout_command can leave the tui in an enabled state if the user has entered an invalid layout name. Instead postpone the call to tui_enable until later in tui_set_layout_for_display_command just before the layout is changed. gdb/ChangeLog: * tui/tui-layout.c (tui_layout_command): Move call to tui_enable into ... (tui_set_layout_for_display_command): ...here, before calling tui_set_layout. Only set the layout if gdb has not already entered the TUI_FAILURE state. --- gdb/ChangeLog | 8 ++++++++ gdb/tui/tui-layout.c | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51d2bfc..8ea1a5e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2015-05-20 Andrew Burgess + * tui/tui-layout.c (tui_layout_command): Move call to tui_enable + into ... + (tui_set_layout_for_display_command): ...here, before calling + tui_set_layout. Only set the layout if gdb has not already + entered the TUI_FAILURE state. + +2015-05-20 Andrew Burgess + * tui/tui-layout.c (layout_completer): New function. (_initialize_tui_layout): Set completer on layout command. diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 45fa575..2e950f7 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -460,7 +460,12 @@ tui_set_layout_for_display_command (const char *layout_name) else status = TUI_FAILURE; - tui_set_layout (new_layout); + if (status == TUI_SUCCESS) + { + /* Make sure the curses mode is enabled. */ + tui_enable (); + tui_set_layout (new_layout); + } } xfree (buf_ptr); } @@ -509,9 +514,6 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) static void tui_layout_command (char *arg, int from_tty) { - /* Make sure the curses mode is enabled. */ - tui_enable (); - /* Switch to the selected layout. */ if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS) warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE);