Fix "list" command in the TUI
authorTom Tromey <tom@tromey.com>
Wed, 13 Nov 2019 23:30:52 +0000 (16:30 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 20 Dec 2019 16:15:58 +0000 (09:15 -0700)
commitfc9d2d724fcc30b66308ae31d3de98e977d27a76
treedcad8d1e7eb22ad6ebc7995268c3b8027deeda1a
parenta75cd9a2c129dfc086cbe570ef9cff9b84570bbd
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
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.tui/list-before.exp [new file with mode: 0644]
gdb/tui/tui-hooks.c