binutils-gdb/gdb/tui
Patrick Palka bbcbf914a6 TUI: Make sure to update registers if frame information has changed
When I replaced TUI's frame_changed hook to fix PR tui/13378 I assumed
that there's no reason to refresh register information following a call
to "up", "down" or "frame".  This assumption was made to fix the problem
of refreshing frame information twice following a sync-execution normal
stop (once in tui_normal_stop and then in tui_before_prompt) -- the
second refresh removing any highlights made by the first.

I was wrong about that -- GDB's snapshot of register information is
per-frame, and when the frame changes, registers do too (most
prominently the %rip and %rsp registers).  So e.g. GDB 7.8 would
highlight such register changes after invoking "up", "down" or "frame",
and current GDB does not.

To fix this regression, this patch adds another (sufficient) condition
for refreshing register information: in
tui_refresh_frame_and_register_information, always refresh register
information if frame information has changed.  This makes register
information get refreshed following a call to "up", "down" or "frame"
while still avoiding the "double refresh" issue following a normal stop.

This condition may seem to obsolete the existing registers_too_p
parameter, but it does not: following a normal stop, it is possible that
registers may have changed while frame information had not.  We could be
on the exact same PC with different register values.  The new condition
would not catch such a case, but the registers_too_p condition will.  So
both conditions seem necessary (and either one is sufficient).

gdb/ChangeLog:

	* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
	Update commentary.  Always refresh the registers when frame
	information has changed.
	* tui/tui-stack.c (tui_show_frame_info): Update commentary.
	Change return type to int.  Return 1 if frame information has
	changed, 1 otherwise.
	(tui_before_prompt): Update commentary.
	* tui/tui-stack.h (tui_show_frame_info): Change return type to
	int.
2015-07-01 12:13:57 -04:00
..
ChangeLog-1998-2003
tui-command.c Remove buggy xterm workaround in tui_dispatch_ctrl_char() 2015-05-14 08:18:06 -04:00
tui-command.h
tui-data.c gdb: Remove register class specific layout names. 2015-05-21 20:47:24 +02:00
tui-data.h gdb: Remove register class specific layout names. 2015-05-21 20:47:24 +02:00
tui-disasm.c Make type-safe the 'content' field of struct tui_gen_win_info 2015-04-27 21:19:53 -04:00
tui-disasm.h
tui-file.c
tui-file.h
tui-hooks.c TUI: Make sure to update registers if frame information has changed 2015-07-01 12:13:57 -04:00
tui-hooks.h
tui-interp.c
tui-io.c Fix undefined behavior in TUI's TAB expansion 2015-03-21 10:48:34 +02:00
tui-io.h
tui-layout.c gdb: Add cleanup to avoid memory leak on error. 2015-05-21 20:49:00 +02:00
tui-layout.h gdb: Remove register class specific layout names. 2015-05-21 20:47:24 +02:00
tui-out.c
tui-regs.c gdb: Rework command completion on 'tui reg'. 2015-06-13 21:28:53 +01:00
tui-regs.h
tui-source.c TUI: avoid calling strcpy() on identical string objects 2015-04-27 21:19:58 -04:00
tui-source.h
tui-stack.c TUI: Make sure to update registers if frame information has changed 2015-07-01 12:13:57 -04:00
tui-stack.h TUI: Make sure to update registers if frame information has changed 2015-07-01 12:13:57 -04:00
tui-win.c Add tab completion for TUI's "focus" command 2015-06-26 10:11:28 -04:00
tui-win.h
tui-windata.c
tui-windata.h
tui-wingeneral.c Do not increment of decrement enums 2015-02-27 17:29:11 +00:00
tui-wingeneral.h
tui-winsource.c Make type-safe the 'content' field of struct tui_gen_win_info 2015-04-27 21:19:53 -04:00
tui-winsource.h
tui.c gdb: New 'tui enable' and 'tui disable' commands. 2015-05-22 12:18:49 +02:00
tui.h gdb: Remove register class specific layout names. 2015-05-21 20:47:24 +02:00