Message ID | 1433260372-12694-1-git-send-email-patrick@parcs.ath.cx |
---|---|
State | New, archived |
Headers |
Received: (qmail 123338 invoked by alias); 2 Jun 2015 15:53:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 122701 invoked by uid 89); 2 Jun 2015 15:53:01 -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-f179.google.com Received: from mail-qk0-f179.google.com (HELO mail-qk0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Jun 2015 15:53:00 +0000 Received: by qkhg32 with SMTP id g32so103284022qkh.0 for <gdb-patches@sourceware.org>; Tue, 02 Jun 2015 08:52:58 -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; bh=sJ36e9kGh8lrSDRKv1XNqn54nIe5VIo+3lhgPOzRo3M=; b=RTZIIun30F3cJVFJ7tg69cMB3X7lL7ZFpd/gJ8x+2pFmyi1vCJT7w7LaagQHIbtYh+ uAZadA+d8TUSKYRgDKh8y99S6ENjnOjCAnwpGPZBA+av/ZNxLFQ6lgFk0Sz14LVCwXuU Cvd2MvDnl+lTmywrbeh8btOhSasWaegLPNzsjC/COK300Uufhl8au09Rub1En+PVZuJp sZ9wPaotOiZ0GCCrSbQYbJifyXXGLNsM/hA2abXwmWl1GSgduv+k2wtkreQZ1D1nOu7u yPh/Z5k90ZWEbl+wGLVnX8bazeV5Ril14cdp1ifx3fifiP+ovmgS8iKDFtPRDhvEcX79 L9ng== X-Gm-Message-State: ALoCoQmlnSfMuBIxoht5RX0Iu0nVYDq1SshI80kbyVQxJO6mRTcJpKT72vOdjM3/4m5VDInig2VD X-Received: by 10.140.99.65 with SMTP id p59mr29673053qge.46.1433260378624; Tue, 02 Jun 2015 08:52:58 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id f192sm7480795qhc.37.2015.06.02.08.52.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jun 2015 08:52:57 -0700 (PDT) From: Patrick Palka <patrick@parcs.ath.cx> To: gdb-patches@sourceware.org Cc: Patrick Palka <patrick@parcs.ath.cx> Subject: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info Date: Tue, 2 Jun 2015 11:52:52 -0400 Message-Id: <1433260372-12694-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <CA+C-WL-r+j7hV_JuT9jCG3KNRyqOp8VbfKiHB0obbGon7FJ1Bg@mail.gmail.com> References: <CA+C-WL-r+j7hV_JuT9jCG3KNRyqOp8VbfKiHB0obbGon7FJ1Bg@mail.gmail.com> |
Commit Message
Patrick Palka
June 2, 2015, 3:52 p.m. UTC
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(+)
Comments
On Tue, Jun 2, 2015 at 11:52 AM, Patrick Palka <patrick@parcs.ath.cx> 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.
On 06/02/2015 04:52 PM, 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. OK, though please try/use target_terminal_ours_for_output instead. I think we should get rid of this hook entirely, and refresh the window at some higher level point. Refreshing the window for each internal stop and/or selected frame save/restore results in lots of pointless flicker... I'm sure you've noticed. :-) Thanks, Pedro Alves
On Mon, Jun 15, 2015 at 11:09 AM, Pedro Alves <palves@redhat.com> wrote: > On 06/02/2015 04:52 PM, 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. > > > OK, though please try/use target_terminal_ours_for_output instead. Okay. > > I think we should get rid of this hook entirely, and refresh > the window at some higher level point. Refreshing the window for > each internal stop and/or selected frame save/restore results in > lots of pointless flicker... I'm sure you've noticed. :-) Good idea. > > Thanks, > Pedro Alves >
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. */