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