Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2008-2020 Free Software Foundation, Inc. |
b89667eb DE |
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 | ||
2390201f DJ |
16 | if [target_info exists gdb,nosignals] { |
17 | verbose "Skipping unwindonsignal.exp because of nosignals." | |
18 | continue | |
19 | } | |
20 | ||
b89667eb | 21 | |
b89667eb DE |
22 | # Some targets can't do function calls, so don't even bother with this |
23 | # test. | |
24 | if [target_info exists gdb,cannot_call_functions] { | |
bc6c7af4 | 25 | unsupported "this target can not call functions" |
b89667eb DE |
26 | continue |
27 | } | |
28 | ||
62cef515 | 29 | standard_testfile |
b89667eb | 30 | |
5b362f04 | 31 | if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { |
62cef515 TT |
32 | return -1 |
33 | } | |
b89667eb DE |
34 | |
35 | if { ![runto_main] } { | |
bc6c7af4 | 36 | fail "can't run to main" |
b89667eb DE |
37 | return 0 |
38 | } | |
39 | ||
40 | gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*" | |
41 | gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \ | |
42 | "continue to breakpoint at stop_here" | |
43 | ||
44 | # Turn on unwindonsignal. | |
27d3a1a2 | 45 | gdb_test_no_output "set unwindonsignal on" \ |
b89667eb | 46 | "setting unwindonsignal" |
27d3a1a2 | 47 | |
b89667eb DE |
48 | gdb_test "show unwindonsignal" \ |
49 | "Unwinding of stack .* is on." \ | |
50 | "showing unwindonsignal" | |
51 | ||
52 | # Call function (causing the program to get a signal), and see if gdb handles | |
53 | # it properly. | |
23ffc893 PA |
54 | if {[gdb_test "call gen_signal ()" \ |
55 | "\[\r\n\]*The program being debugged was signaled.*" \ | |
56 | "unwindonsignal, inferior function call signaled"] != 0} { | |
57 | return 0 | |
b89667eb DE |
58 | } |
59 | ||
60 | # Verify the stack got unwound. | |
61 | gdb_test "bt" \ | |
62 | "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \ | |
63 | "unwindonsignal, stack unwound" | |
64 | ||
65 | # Verify the dummy frame got removed from dummy_frame_stack. | |
66 | gdb_test_multiple "maint print dummy-frames" \ | |
67 | "unwindonsignal, dummy frame removed" { | |
68 | -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" { | |
69 | fail "unwindonsignal, dummy frame removed" | |
70 | } | |
71 | -re "\[\r\n\]+$gdb_prompt $" { | |
72 | pass "unwindonsignal, dummy frame removed" | |
73 | } | |
74 | } | |
75 | ||
76 | return 0 |