1 # Copyright 2019-2021 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Test whether we can load a corefile, enable TUI and then invoke
17 # "run" without having a segfault.
19 # Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117
23 standard_testfile tui-layout.c
25 set core "${testfile}.core"
27 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
31 # Only run on native boards.
32 if { [use_gdb_stub] || [target_info gdb_protocol] == "extended-remote" } {
33 untested "not supported"
37 if { ![runto_main] } {
38 untested "could not run to main"
42 if { ![gdb_gcore_cmd "$core" "save a corefile"] } {
43 untested "could not generate a corefile"
47 Term::clean_restart 24 80 $testfile
48 if {![Term::enter_tui]} {
49 unsupported "TUI not supported"
53 set text [Term::get_all_lines]
54 gdb_assert {![string match "No Source Available" $text]} \
55 "initial source listing"
57 Term::command "core-file $core"
58 Term::check_contents "load corefile" "21 *return 0"
61 Term::check_contents "run until the end" \
62 "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]"