From patchwork Sat Jan 4 21:37:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37199 Received: (qmail 58085 invoked by alias); 4 Jan 2020 21:37:12 -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 58076 invoked by uid 89); 4 Jan 2020 21:37:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.59.4) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Jan 2020 21:37:10 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway20.websitewelcome.com (Postfix) with ESMTP id E3D34400D375D for ; Sat, 4 Jan 2020 14:25:25 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id nr6ViZJCyW4frnr6VipvcQ; Sat, 04 Jan 2020 15:37:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=h6YgZoU4eGupNkJTnC4LPbzpNlMpdIqkPVtXw9qKVC0=; b=BH71V2qEnbHGiyGeWoYaH0s5wo vFq3CElC6SqyMD7y1tnwaqJzAQhbLdoORPgWD24A4/ONhbF5DCOJsJx2PtjgQlfavZrQmBvj5HgnY 5iMpH7pc2qCXRkaEcSXTee3QU; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:50482 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1inr6V-003Aem-5P; Sat, 04 Jan 2020 14:37:03 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Make TUI borders respect "set style enabled" Date: Sat, 4 Jan 2020 14:37:01 -0700 Message-Id: <20200104213701.14414-1-tom@tromey.com> When adding support for styling the TUI borders, I neglected to have this code check cli_styling. As a result, "set style enabled off" does not affect the borders. This patch fixes this oversight. While doing this, I found that running gdb without an executable, enabling the TUI, and then trying "set style enabled off" would fail with the mysterious "No registers". The fix for this is to use deprecated_safe_get_selected_frame in tui_source_window_base::refill. gdb/ChangeLog 2020-01-04 Tom Tromey * tui/tui-wingeneral.c (box_win): Check cli_styling. * tui/tui-winsource.c (tui_source_window_base::refill): Use deprecated_safe_get_selected_frame. Change-Id: I36acda25dd9014d994d366b4a0e8faee9d95d0f8 --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-wingeneral.c | 7 ++++--- gdb/tui/tui-winsource.c | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index dae4255ada2..0a9fc5238d6 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -55,9 +55,10 @@ box_win (struct tui_win_info *win_info, /* tui_apply_style resets the style entirely, so be sure to call it before applying ATTRS. */ - tui_apply_style (win, (highlight_flag - ? tui_active_border_style.style () - : tui_border_style.style ())); + if (cli_styling) + tui_apply_style (win, (highlight_flag + ? tui_active_border_style.style () + : tui_border_style.style ())); wattron (win, attrs); #ifdef HAVE_WBORDER wborder (win, tui_border_vline, tui_border_vline, diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 69070115ec6..fbee2e3e181 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -352,7 +352,11 @@ tui_source_window_base::refill () { sal = get_current_source_symtab_and_line (); if (sal.symtab == NULL) - sal = find_pc_line (get_frame_pc (get_selected_frame (NULL)), 0); + { + struct frame_info *fi = deprecated_safe_get_selected_frame (); + if (fi != nullptr) + sal = find_pc_line (get_frame_pc (fi), 0); + } } if (sal.pspace == nullptr)