Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.python / py-unwind.exp
blob1810214082a87247af912b00d75fd1a576a34a4a
1 # Copyright (C) 2015-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/>.
16 # This file is part of the GDB testsuite.  It verifies that frame
17 # unwinders can be implemented in Python.
19 load_lib gdb-python.exp
21 standard_testfile
23 # Stack protection can make the stack look a bit different, breaking the
24 # assumptions this test has about its layout.
26 set flags "additional_flags=-fno-stack-protector"
28 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} "debug $flags"] } {
29     return -1
32 # Skip all tests if Python scripting is not enabled.
33 if { [skip_python_tests] } { continue }
35 # This test runs on a specific platform.
36 if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { continue }
38 # The following tests require execution.
40 if {![runto_main]} {
41     return 0
44 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
46 gdb_breakpoint [gdb_get_line_number "break backtrace-broken"]
48 gdb_test "source ${pyfile}" "Python script imported" \
49          "import python scripts"
51 gdb_continue_to_breakpoint "break backtrace-broken"
52 gdb_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"
58 # Check that the Python unwinder frames can be flushed / released.
59 gdb_test "maint flush register-cache" "Register cache flushed\\." "flush frames"
61 # Check that invalid register names cause errors.
62 gdb_test "python print(add_saved_register_error)" "True" \
63     "add_saved_register error"
64 gdb_test "python print(read_register_error)" "True" \
65     "read_register error"