]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/unwindonsignal.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / unwindonsignal.exp
CommitLineData
1d506c26 1# Copyright 2008-2024 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
450d26c8 16require {!target_info exists gdb,nosignals}
2390201f 17
b89667eb 18
b89667eb
DE
19# Some targets can't do function calls, so don't even bother with this
20# test.
450d26c8 21require {!target_info exists gdb,cannot_call_functions}
b89667eb 22
62cef515 23standard_testfile
b89667eb 24
5b362f04 25if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
62cef515
TT
26 return -1
27}
b89667eb
DE
28
29if { ![runto_main] } {
b89667eb
DE
30 return 0
31}
32
33gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*"
34gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \
35 "continue to breakpoint at stop_here"
36
37# Turn on unwindonsignal.
27d3a1a2 38gdb_test_no_output "set unwindonsignal on" \
b89667eb 39 "setting unwindonsignal"
27d3a1a2 40
b89667eb
DE
41gdb_test "show unwindonsignal" \
42 "Unwinding of stack .* is on." \
43 "showing unwindonsignal"
44
45# Call function (causing the program to get a signal), and see if gdb handles
46# it properly.
23ffc893 47if {[gdb_test "call gen_signal ()" \
3ce8f906
AB
48 [multi_line \
49 "The program being debugged received signal SIGABRT, Aborted" \
50 "while in a function called from GDB\\. GDB has restored the context" \
51 "to what it was before the call\\. To change this behavior use" \
52 "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \
53 "the function \\(gen_signal\\) will be abandoned\\."] \
23ffc893
PA
54 "unwindonsignal, inferior function call signaled"] != 0} {
55 return 0
b89667eb
DE
56}
57
58# Verify the stack got unwound.
59gdb_test "bt" \
60 "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \
61 "unwindonsignal, stack unwound"
62
63# Verify the dummy frame got removed from dummy_frame_stack.
64gdb_test_multiple "maint print dummy-frames" \
65 "unwindonsignal, dummy frame removed" {
66 -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" {
67 fail "unwindonsignal, dummy frame removed"
68 }
69 -re "\[\r\n\]+$gdb_prompt $" {
70 pass "unwindonsignal, dummy frame removed"
71 }
72}