Commit | Line | Data |
---|---|---|
b89667eb DE |
1 | # Copyright 2008 Free Software Foundation, Inc. |
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 | if $tracelevel then { | |
17 | strace $tracelevel | |
18 | } | |
19 | ||
20 | if [target_info exists gdb,noinferiorio] { | |
21 | verbose "Skipping unwindonsignal.exp because of no fileio capabilities." | |
22 | continue | |
23 | } | |
24 | ||
25 | set prms_id 0 | |
26 | set bug_id 0 | |
27 | ||
28 | set testfile "unwindonsignal" | |
29 | set srcfile ${testfile}.c | |
30 | set binfile ${objdir}/${subdir}/${testfile} | |
31 | ||
32 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
33 | untested unwindonsignal.exp | |
34 | return -1 | |
35 | } | |
36 | ||
37 | # Some targets can't do function calls, so don't even bother with this | |
38 | # test. | |
39 | if [target_info exists gdb,cannot_call_functions] { | |
40 | setup_xfail "*-*-*" 2416 | |
41 | fail "This target can not call functions" | |
42 | continue | |
43 | } | |
44 | ||
45 | # Start with a fresh gdb. | |
46 | ||
47 | gdb_exit | |
48 | gdb_start | |
49 | gdb_reinitialize_dir $srcdir/$subdir | |
50 | gdb_load ${binfile} | |
51 | ||
52 | if { ![runto_main] } { | |
53 | fail "Can't run to main" | |
54 | return 0 | |
55 | } | |
56 | ||
57 | gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*" | |
58 | gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \ | |
59 | "continue to breakpoint at stop_here" | |
60 | ||
61 | # Turn on unwindonsignal. | |
62 | gdb_test "set unwindonsignal on" \ | |
63 | "" \ | |
64 | "setting unwindonsignal" | |
65 | gdb_test "show unwindonsignal" \ | |
66 | "Unwinding of stack .* is on." \ | |
67 | "showing unwindonsignal" | |
68 | ||
69 | # Call function (causing the program to get a signal), and see if gdb handles | |
70 | # it properly. | |
71 | gdb_test_multiple "call gen_signal ()" \ | |
72 | "unwindonsignal, inferior function call signaled" { | |
73 | -re "\[\r\n\]*no signal\[\r\n\]+$gdb_prompt $" { | |
74 | unsupported "unwindonsignal, inferior function call signaled" | |
75 | return 0 | |
76 | } | |
77 | -re "\[\r\n\]*The program being debugged was signaled.*\[\r\n\]+$gdb_prompt $" { | |
78 | pass "unwindonsignal, inferior function call signaled" | |
79 | } | |
80 | } | |
81 | ||
82 | # Verify the stack got unwound. | |
83 | gdb_test "bt" \ | |
84 | "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \ | |
85 | "unwindonsignal, stack unwound" | |
86 | ||
87 | # Verify the dummy frame got removed from dummy_frame_stack. | |
88 | gdb_test_multiple "maint print dummy-frames" \ | |
89 | "unwindonsignal, dummy frame removed" { | |
90 | -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" { | |
91 | fail "unwindonsignal, dummy frame removed" | |
92 | } | |
93 | -re "\[\r\n\]+$gdb_prompt $" { | |
94 | pass "unwindonsignal, dummy frame removed" | |
95 | } | |
96 | } | |
97 | ||
98 | return 0 |