From patchwork Tue Jun 2 01:57:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 7003 Received: (qmail 41280 invoked by alias); 2 Jun 2015 01:57:52 -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 41268 invoked by uid 89); 2 Jun 2015 01:57:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-qk0-f175.google.com Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Jun 2015 01:57:51 +0000 Received: by qkhg32 with SMTP id g32so93937309qkh.0 for ; Mon, 01 Jun 2015 18:57:49 -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=Zx5bdtNXZyfFXg+8H020J7RA0OH7XgfASnSbsfk5iJg=; b=fojxnbaG4HLgdqEfs5oef6O13bCJ6lJX0JpaP/u1uksv0cdeaQ9kP1zZAtHZ7vVTy9 BwvYAvJbJhHMyu5VMqAVvFrQkv4rTI/mkoxE5F2ZC+Fr20E784IPZhexRtsSX2NvLGlJ mEpVAx80d1eHU0ZDF3+mXX5whJhBkmyp6DkRVxJ23HtjxO0smNKED1p0t+p4+k4heb5y 1OMmt84JcHBKmhxYSCYJ9+G2wwHlNs5JCdF7q5mUmbg1+ef4FTtlXaHcFCkAJEX11a91 gi+e+1e+qm2trtmtz/Z8jGxGGWAjYo1CqO/2f1e7Ad1BTLBgjP5ACj17mgNsGRSuhdIj HWDA== X-Gm-Message-State: ALoCoQn4hJDTJV5zC4WPoUnaF4UDsJF4It73Dwlf0WpI2H/z7l2o9FPYygpGC/nJwqy4rRfB+RK7 X-Received: by 10.55.18.9 with SMTP id c9mr44308003qkh.50.1433210269002; Mon, 01 Jun 2015 18:57:49 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id 67sm6807535qhw.43.2015.06.01.18.57.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 18:57:47 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info Date: Mon, 1 Jun 2015 21:57:41 -0400 Message-Id: <1433210261-18328-1-git-send-email-patrick@parcs.ath.cx> In some cases tui_show_frame_info() may get called while the inferior's terminal settings are still in effect. But when we call this function we absolutely need to have our terminal settings in effect because the function is responsible for redrawing TUI's windows following a change in the selected frame or a change in the PC. If our terminal settings are not in effect, the screen does not get redrawn properly, causing temporary display artifacts (which can be fixed via ^L). This scenario happens most prominently when stepping through a program in TUI while a watchpoint is in effect. Here is an example backtrace for when tui_show_frame_info() gets called while target_terminal_is_inferior() == 1: #1 0x00000000004988ee in tui_selected_frame_level_changed_hook (level=0) #2 0x0000000000617b99 in select_frame (fi=0x18c9820) #3 0x0000000000617c3f in get_selected_frame (message=message@entry=0x0) #4 0x00000000004ce534 in update_watchpoint (b=b@entry=0x2d9a760, reparse=reparse@entry=0) #5 0x00000000004d625e in insert_breakpoints () #6 0x0000000000531cfe in keep_going (ecs=ecs@entry=0x7ffea7884ac0) #7 0x00000000005326d7 in process_event_stop_test (ecs=ecs@entry=0x7ffea7884ac0) #8 0x000000000053596e in handle_inferior_event_1 (ecs=0x7ffea7884ac0) The fix is simple: call target_terminal_ours() before calling tui_show_frame_info() in TUI's frame-changed hook. gdb/ChangeLog: * tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call target_terminal_ours() before calling tui_show_frame_info(). --- gdb/tui/tui-hooks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index e53f526..1eb5300 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -132,6 +132,8 @@ tui_selected_frame_level_changed_hook (int level) if (level < 0) return; + target_terminal_ours (); + fi = get_selected_frame (NULL); /* Ensure that symbols for this frame are read in. Also, determine the source language of this frame, and switch to it if