1 # Copyright
2004-2023 Free Software Foundation
, Inc.
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.
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.
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
/>.
17 # The
program sigaltstack.c creates a backtrace containing nested
18 #
signal handlers
on an alternative stack. This in turn leads to a
19 # non
-contiguous
(and possibly non
-monotonic
) backtrace
- stack
20 # address jump at the
normal-alt stack boundary.
22 # This test confirms that GDB can both backtrace through and finish
25 require
{!target_info
exists gdb
,nosignals
}
30 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
31 untested
"failed to compile"
36 clean_restart $
{binfile
}
38 # Pass all the alarms straight through
(but verbosely
)
39 gdb_test
"handle SIGALRM print pass nostop"
40 gdb_test
"handle SIGVTALRM print pass nostop"
41 gdb_test
"handle SIGPROF print pass nostop"
48 # Stop in handle
, when at the inner most level
49 gdb_test
"break catcher if level == INNER"
50 gdb_test
"continue" ".* catcher .*" "continue to catch"
51 # step
off the assignment
55 gdb_test_sequence
"bt" "backtrace" {
56 "\[\r\n\]+.0 \[^\r\n\]* catcher "
57 "\[\r\n\]+.1 .signal handler called."
58 "\[\r\n\]+.2 \[^\r\n\]* thrower .next_level=INNER"
59 "\[\r\n\]+.3 \[^\r\n\]* catcher "
60 "\[\r\n\]+.4 .signal handler called."
61 "\[\r\n\]+.5 \[^\r\n\]* thrower .next_level=OUTER"
62 "\[\r\n\]+.6 \[^\r\n\]* catcher "
63 "\[\r\n\]+.7 \[^\r\n\]* main "
66 proc finish_test
{ pattern msg
} {
69 gdb_test_multiple
"finish" $msg {
70 -re
"Cannot insert breakpoint 0.*${gdb_prompt} $" {
71 # Some platforms use a special read
-only
page for signal
72 # trampolines. We can
't set a breakpoint there, and we
73 # don't gracefully fall
back to single
-stepping.
74 setup_kfail gdb
/8841 "i?86-*-linux*"
75 setup_kfail gdb
/8841 "*-*-openbsd*"
76 setup_kfail gdb
/8841 "nios2-*-linux*"
77 fail
"$msg (could not set breakpoint)"
79 -re
"$pattern.*${gdb_prompt} $" {
86 finish_test
"signal handler called." "finish from catch LEAF"
87 finish_test
"thrower .next_level=INNER, .*" "finish to throw INNER"
88 finish_test
"catcher .*" "finish to catch INNER"
89 finish_test
"signal handler called.*" "finish from catch INNER"
90 finish_test
"thrower .next_level=OUTER, .*" "finish to OUTER"
91 finish_test
"catcher .*" "finish to catch MAIN"
92 finish_test
"main .*" "finish to MAIN"