From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85031 invoked by alias); 13 Jun 2015 16:48:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85021 invoked by uid 89); 13 Jun 2015 16:48:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-ob0-f177.google.com Received: from mail-ob0-f177.google.com (HELO mail-ob0-f177.google.com) (209.85.214.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 13 Jun 2015 16:48:57 +0000 Received: by obbsn1 with SMTP id sn1so40182327obb.1 for ; Sat, 13 Jun 2015 09:48:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=GCAKgU3VE8BBuO246zUaAQmNW8jyj6QVEo9eRzp21VM=; b=EDKzNYdMJ1hZ1pBurzuGyTaWUNnzd3KT2q27Ot94veCyk0wO0ytFM3rlLEgyyE1sLQ PridXFibM88F829Dqcx2pnjr4oRITlC0BGBkRijPKv0tMdcn2NxNPHZOjPNFzaDH7W1B jr6WzHWt3bzSq2k05yGUshsVrkjyYD9Pu/owGQOfi8KnBnj3Lqr4QJJn+sWygrhH6hGv 6LCQzt0lUoUgLnh4xkXMrYbbdiRTJsiiCxWty7uHFwy0A/5gaxwH03zViYeZmLYM9FAP Hm+7cy/6rJfTqIuNrZppohA9CEF38DTkLGcjhXmltZuRc5IQuItUy9DhKHM5cfTBLypf lmHA== X-Gm-Message-State: ALoCoQl0kppz4pXIB0xAGJA9m1MnF8ecmTB24PyrwfyA6KiKO2h2Fti3+OdK4yNQtj6xxdcF8eJx X-Received: by 10.202.54.3 with SMTP id d3mr16040573oia.103.1434214135843; Sat, 13 Jun 2015 09:48:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.96.167 with HTTP; Sat, 13 Jun 2015 09:48:35 -0700 (PDT) In-Reply-To: <1433260372-12694-1-git-send-email-patrick@parcs.ath.cx> References: <1433260372-12694-1-git-send-email-patrick@parcs.ath.cx> From: Patrick Palka Date: Sat, 13 Jun 2015 16:48:00 -0000 Message-ID: Subject: Re: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info To: "gdb-patches@sourceware.org" Cc: Patrick Palka Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-06/txt/msg00276.txt.bz2 On Tue, Jun 2, 2015 at 11:52 AM, Patrick Palka wrote: > 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, making sure to > restore the original terminal settings afterwards. > > gdb/ChangeLog: > > * tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call > target_terminal_ours() before calling tui_show_frame_info(), and > restore the original terminal settings afterwards. > --- > gdb/tui/tui-hooks.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c > index e53f526..3331d67 100644 > --- a/gdb/tui/tui-hooks.c > +++ b/gdb/tui/tui-hooks.c > @@ -127,11 +127,15 @@ tui_selected_frame_level_changed_hook (int level) > { > struct frame_info *fi; > CORE_ADDR pc; > + struct cleanup *old_chain; > > /* Negative level means that the selected frame was cleared. */ > if (level < 0) > return; > > + old_chain = make_cleanup_restore_target_terminal (); > + 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 > @@ -160,6 +164,8 @@ tui_selected_frame_level_changed_hook (int level) > tui_check_data_values (fi); > tui_refreshing_registers = 0; > } > + > + do_cleanups (old_chain); > } > > /* Called from print_frame_info to list the line we stopped in. */ > -- > 2.4.2.387.gf86f31a.dirty > Ping. Could this patch make it into 7.10? It is pretty harmless.