diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 681ecd0c3d..8d6f9cc981 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-03-07 Pedro Alves + + * tui/tui-regs.c (tui_restore_gdbout): Don't delete gdb_stdout. + 2017-03-07 Walfred Tedeschi * i387-tdep.h (i387_reset_bnd_regs): Add function definition. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cc1a14ae3f..c99f644c9b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-07 Pedro Alves + + * gdb.base/tui-layout.c: New file. + * gdb.base/tui-layout.exp: New file. + 2017-03-07 Pedro Alves * gdb.base/tui-layout.c: Rename to ... diff --git a/gdb/testsuite/gdb.base/tui-layout.c b/gdb/testsuite/gdb.base/tui-layout.c new file mode 100644 index 0000000000..956545fdbe --- /dev/null +++ b/gdb/testsuite/gdb.base/tui-layout.c @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2017 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 . */ + +int +main () +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/tui-layout.exp b/gdb/testsuite/gdb.base/tui-layout.exp new file mode 100644 index 0000000000..41f9ceb998 --- /dev/null +++ b/gdb/testsuite/gdb.base/tui-layout.exp @@ -0,0 +1,56 @@ +# Copyright 2017 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 . + +# Minimal testcase that just checks that the various "layout $foo" +# commands do not cause gdb to crash. + +standard_testfile + +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { + return -1 +} + +if {[skip_tui_tests]} { + return +} + +# Test one layout command. EXECUTION indicates whether to activate +# the layout with or without execution. + +proc test_layout {layout execution} { + global binfile gdb_prompt + + clean_restart $binfile + + if {$execution} { + if ![runto_main] then { + fail "can't run to main" + return 0 + } + } + + set test "layout command" + gdb_test_multiple "layout $layout" $test { + -re "$gdb_prompt $" { + pass $test + } + } +} + +foreach_with_prefix execution {0 1} { + foreach_with_prefix layout {"asm" "reg" "src" "split"} { + test_layout $layout $execution + } +} diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 7d116ee8d7..3f9a007b19 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -711,7 +711,6 @@ TUI command to control the register window."), tuicmd); static void tui_restore_gdbout (void *ui) { - delete gdb_stdout; gdb_stdout = (struct ui_file*) ui; pagination_enabled = 1; }