Re: [PATCH 2/3] Be lazy about refreshing the windows in tui_show_frame_info (PR tui/13378)

Pedro Alves
2015-06-30T17:26:44Z

On 06/30/2015 05:51 PM, Patrick Palka wrote:
> [ This version just changes tui_set_locator_info as you suggested. ]
>
> tui_show_frame_info is responsible for updating the visible windows
> following a change in frame information (that being the currently
> selected frame, PC, line number, etc). Currently it always redraws and
> refreshes each window even if frame information has not changed. This
> behavior is inefficient and helps contribute to the occassional
> flickering of the TUI as described in the mentioned PR.
>
> This patch makes tui_show_frame_info refresh the windows only if frame
> information has changed. Determining whether frame information has
> changed is done indirectly by determining whether the locator has
> changed. This approach is convenient and yet sensible because the
> locator contains all the relevant info we need to check anyway: the
> current PC, the line number, the name of the executable and the name of
> the current function. Probably only the PC is really necessary to
> check, but it doesn't hurt to check every field.
>
> Effectively, with this patch, consecutive calls to select_frame with the
> same frame/PC no longer cause TUI's frame information to be updated
> multiple times.
>
> gdb/ChangeLog:
>
> * tui/tui-stack.c (tui_set_locator_info): Change prototype to
> return an int instead of void. Return whether the locator
> window has changed.
> (tui_show_frame_info): If the locator info has not changed, then
> bail out early to avoid refreshing the windows.

OK.

Thanks,
Pedro Alves