This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info
- From: Pedro Alves <palves at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, gdb-patches at sourceware dot org
- Date: Mon, 15 Jun 2015 16:09:36 +0100
- Subject: Re: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info
- Authentication-results: sourceware.org; auth=none
- References: <CA+C-WL-r+j7hV_JuT9jCG3KNRyqOp8VbfKiHB0obbGon7FJ1Bg at mail dot gmail dot com> <1433260372-12694-1-git-send-email-patrick at parcs dot ath dot cx>
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