Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2019-2020 Free Software Foundation, Inc. |
494409bb SDJ |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | # Test whether we can load a corefile, enable TUI and then invoke | |
17 | # "run" without having a segfault. | |
18 | # | |
19 | # Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117 | |
20 | ||
8c74a764 | 21 | tuiterm_env |
494409bb SDJ |
22 | |
23 | standard_testfile tui-layout.c | |
24 | ||
25 | set core "${testfile}.core" | |
26 | ||
27 | if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { | |
28 | return -1 | |
29 | } | |
30 | ||
31 | # Only run on native boards. | |
32 | if { [use_gdb_stub] || [target_info gdb_protocol] == "extended-remote" } { | |
33 | untested "not supported" | |
34 | return | |
35 | } | |
36 | ||
37 | if { ![runto_main] } { | |
38 | untested "could not run to main" | |
39 | return -1 | |
40 | } | |
41 | ||
42 | if { ![gdb_gcore_cmd "$core" "save a corefile"] } { | |
43 | untested "could not generate a corefile" | |
44 | return -1 | |
45 | } | |
46 | ||
47 | Term::clean_restart 24 80 $testfile | |
48 | if {![Term::enter_tui]} { | |
49 | unsupported "TUI not supported" | |
50 | } | |
51 | ||
52 | set text [Term::get_all_lines] | |
53 | gdb_assert {![string match "No Source Available" $text]} \ | |
54 | "initial source listing" | |
55 | ||
56 | Term::command "core-file $core" | |
57 | Term::check_contents "load corefile" "21 *return 0" | |
58 | ||
59 | Term::command "run" | |
60 | Term::check_contents "run until the end" \ | |
61 | "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]" |