Update year range in copyright notice of all files owned by the GDB project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / unwindonsignal.exp
1 # Copyright 2008-2015 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 [target_info exists gdb,noinferiorio] {
17 verbose "Skipping unwindonsignal.exp because of no fileio capabilities."
18 continue
19 }
20
21 if [target_info exists gdb,nosignals] {
22 verbose "Skipping unwindonsignal.exp because of nosignals."
23 continue
24 }
25
26
27 # Some targets can't do function calls, so don't even bother with this
28 # test.
29 if [target_info exists gdb,cannot_call_functions] {
30 setup_xfail "*-*-*" 2416
31 fail "This target can not call functions"
32 continue
33 }
34
35 standard_testfile
36
37 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
38 untested $testfile.exp
39 return -1
40 }
41
42 if { ![runto_main] } {
43 fail "Can't run to main"
44 return 0
45 }
46
47 gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*"
48 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \
49 "continue to breakpoint at stop_here"
50
51 # Turn on unwindonsignal.
52 gdb_test_no_output "set unwindonsignal on" \
53 "setting unwindonsignal"
54
55 gdb_test "show unwindonsignal" \
56 "Unwinding of stack .* is on." \
57 "showing unwindonsignal"
58
59 # Call function (causing the program to get a signal), and see if gdb handles
60 # it properly.
61 gdb_test_multiple "call gen_signal ()" \
62 "unwindonsignal, inferior function call signaled" {
63 -re "\[\r\n\]*no signal\[\r\n\]+$gdb_prompt $" {
64 unsupported "unwindonsignal, inferior function call signaled"
65 return 0
66 }
67 -re "\[\r\n\]*The program being debugged was signaled.*\[\r\n\]+$gdb_prompt $" {
68 pass "unwindonsignal, inferior function call signaled"
69 }
70 }
71
72 # Verify the stack got unwound.
73 gdb_test "bt" \
74 "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \
75 "unwindonsignal, stack unwound"
76
77 # Verify the dummy frame got removed from dummy_frame_stack.
78 gdb_test_multiple "maint print dummy-frames" \
79 "unwindonsignal, dummy frame removed" {
80 -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" {
81 fail "unwindonsignal, dummy frame removed"
82 }
83 -re "\[\r\n\]+$gdb_prompt $" {
84 pass "unwindonsignal, dummy frame removed"
85 }
86 }
87
88 return 0
This page took 0.041343 seconds and 5 git commands to generate.