diff options
author | Tom Tromey <tom@tromey.com> | 2019-11-13 16:30:52 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-12-20 09:15:58 -0700 |
commit | fc9d2d724fcc30b66308ae31d3de98e977d27a76 (patch) | |
tree | dcad8d1e7eb22ad6ebc7995268c3b8027deeda1a /gdb/testsuite | |
parent | a75cd9a2c129dfc086cbe570ef9cff9b84570bbd (diff) | |
download | binutils-gdb-fc9d2d724fcc30b66308ae31d3de98e977d27a76.tar.gz |
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
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/list-before.exp | 34 |
2 files changed, 38 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f25787c0866..4476549be6b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2019-12-20 Tom Tromey <tom@tromey.com> + * gdb.tui/list-before.exp: New file. + +2019-12-20 Tom Tromey <tom@tromey.com> + * gdb.tui/list.exp: Check for source on initial listing. 2019-12-11 Tom Tromey <tromey@adacore.com> diff --git a/gdb/testsuite/gdb.tui/list-before.exp b/gdb/testsuite/gdb.tui/list-before.exp new file mode 100644 index 00000000000..a8c931b4ee9 --- /dev/null +++ b/gdb/testsuite/gdb.tui/list-before.exp @@ -0,0 +1,34 @@ +# Copyright 2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Ensure that "list" before starting the TUI will affect the view. + +load_lib "tuiterm.exp" + +standard_testfile tui-layout.c + +if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { + return -1 +} + +Term::clean_restart 24 80 $testfile + +gdb_test "list main" + +if {![Term::enter_tui]} { + unsupported "TUI not supported" +} + +Term::check_contents "initial source listing" "21 *return 0" |