Fix "list" command in the TUI
PR tui/18932 notes that "list" no longer works in the TUI. At some
point in the past, it switched the TUI source window to show the
specified source; but now this source briefly flashes before the TUI
reverts to showing the current stack frame's source.
This patch fixes this bug by introducing a new observer that notices
when the user selected context has changed. Then, the existing
before-prompt observer is updated to request the correct update:
either one based on the current stack frame, or one based on the
user's source symtab_and_line.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
PR tui/18932:
* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
Rename parameters. Handle the not-from-stack-frame case.
(from_stack, from_source_symtab): New globals.
(tui_before_prompt, tui_normal_stop): Update.
(tui_context_changed, tui_symtab_changed): New functions.
(tui_attach_detach_observers): Attach new observers.
gdb/testsuite/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* gdb.tui/list-before.exp: New file.
Change-Id: I62013825f6c1afdd568a1c7a8c019b0c881131af