diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fc0656c03d3..0ff44e50016 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-01-09 Andrew Burgess + + * tui/tui.c (tui_enable): Register tui hooks after calling + tui_display_main. + 2020-01-09 Christian Biesinger * gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 78880be4843..0f2333bc1c4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-01-09 Andrew Burgess + + * gdb.tui/tui-layout-asm.exp: New file. + 2020-01-09 Andrew Burgess * lib/tuiterm.exp (Term::check_box_contents): New proc. diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp new file mode 100644 index 00000000000..cec2735764e --- /dev/null +++ b/gdb/testsuite/gdb.tui/tui-layout-asm.exp @@ -0,0 +1,34 @@ +# Copyright 2020 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 . + +# Ensure that 'layout asm' before starting the inferior puts us in the +# asm layout and displays the disassembly for main. + +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 +if {![Term::prepare_for_tui]} { + unsupported "TUI not supported" +} + +# This puts us into TUI mode, and should display the ASM window. +Term::command "layout asm" +Term::check_box_contents "check asm box contents" 0 0 80 15 "
" diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 7ff5825ece2..99d30a55a15 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -489,10 +489,6 @@ tui_enable (void) clearok (stdscr, TRUE); } - /* Install the TUI specific hooks. */ - tui_install_hooks (); - rl_startup_hook = tui_rl_startup_hook; - if (tui_update_variables ()) tui_rehighlight_all (); @@ -513,6 +509,12 @@ tui_enable (void) else tui_display_main (); + /* Install the TUI specific hooks. This must be done after the call to + tui_display_main so that we don't detect the symtab changed event it + can cause. */ + tui_install_hooks (); + rl_startup_hook = tui_rl_startup_hook; + /* Restore TUI keymap. */ tui_set_key_mode (tui_current_key_mode);