GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / unwindonsignal.exp
1 # Copyright 2008-2016 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,nosignals] {
17 verbose "Skipping unwindonsignal.exp because of nosignals."
18 continue
19 }
20
21
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] {
25 setup_xfail "*-*-*" 2416
26 fail "This target can not call functions"
27 continue
28 }
29
30 standard_testfile
31
32 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
33 untested $testfile.exp
34 return -1
35 }
36
37 if { ![runto_main] } {
38 fail "Can't run to main"
39 return 0
40 }
41
42 gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*"
43 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \
44 "continue to breakpoint at stop_here"
45
46 # Turn on unwindonsignal.
47 gdb_test_no_output "set unwindonsignal on" \
48 "setting unwindonsignal"
49
50 gdb_test "show unwindonsignal" \
51 "Unwinding of stack .* is on." \
52 "showing unwindonsignal"
53
54 # Call function (causing the program to get a signal), and see if gdb handles
55 # it properly.
56 if {[gdb_test "call gen_signal ()" \
57 "\[\r\n\]*The program being debugged was signaled.*" \
58 "unwindonsignal, inferior function call signaled"] != 0} {
59 return 0
60 }
61
62 # Verify the stack got unwound.
63 gdb_test "bt" \
64 "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \
65 "unwindonsignal, stack unwound"
66
67 # Verify the dummy frame got removed from dummy_frame_stack.
68 gdb_test_multiple "maint print dummy-frames" \
69 "unwindonsignal, dummy frame removed" {
70 -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" {
71 fail "unwindonsignal, dummy frame removed"
72 }
73 -re "\[\r\n\]+$gdb_prompt $" {
74 pass "unwindonsignal, dummy frame removed"
75 }
76 }
77
78 return 0
This page took 0.031398 seconds and 4 git commands to generate.