]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.python/py-unwind.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-unwind.exp
CommitLineData
213516ef 1# Copyright (C) 2015-2023 Free Software Foundation, Inc.
d11916aa
SS
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# This file is part of the GDB testsuite. It verifies that frame
17# unwinders can be implemented in Python.
18
19load_lib gdb-python.exp
20
21standard_testfile
22
dcd27ddf
SM
23# Stack protection can make the stack look a bit different, breaking the
24# assumptions this test has about its layout.
25
26set flags "additional_flags=-fno-stack-protector"
27
28if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} "debug $flags"] } {
d11916aa
SS
29 return -1
30}
31
32# Skip all tests if Python scripting is not enabled.
33if { [skip_python_tests] } { continue }
34
35# This test runs on a specific platform.
72b5d099 36if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { continue }
d11916aa
SS
37
38# The following tests require execution.
39
b0e16ca5 40if {![runto_main]} {
d11916aa
SS
41 return 0
42}
43
44set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
45
46gdb_breakpoint [gdb_get_line_number "break backtrace-broken"]
47
48gdb_test "source ${pyfile}" "Python script imported" \
49 "import python scripts"
50
51gdb_continue_to_breakpoint "break backtrace-broken"
52gdb_test_sequence "where" "Backtrace restored by unwinder" {
53 "\\r\\n#0 .* corrupt_frame_inner \\(\\) at "
54 "\\r\\n#1 .* corrupt_frame_outer \\(\\) at "
55 "\\r\\n#2 .* main \\(.*\\) at"
56}
57
8455d262 58# Check that the Python unwinder frames can be flushed / released.
50a5f187 59gdb_test "maint flush register-cache" "Register cache flushed\\." "flush frames"
bdc8cfc1
TT
60
61# Check that invalid register names cause errors.
62gdb_test "python print(add_saved_register_error)" "True" \
63 "add_saved_register error"
64gdb_test "python print(read_register_error)" "True" \
65 "read_register error"