Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright (C) 2015-2018 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 | ||
19 | load_lib gdb-python.exp | |
20 | ||
21 | standard_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 | ||
26 | set flags "additional_flags=-fno-stack-protector" | |
27 | ||
28 | if { [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. | |
33 | if { [skip_python_tests] } { continue } | |
34 | ||
35 | # This test runs on a specific platform. | |
72b5d099 | 36 | if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { continue } |
d11916aa SS |
37 | |
38 | # The following tests require execution. | |
39 | ||
40 | if ![runto_main] then { | |
bc6c7af4 | 41 | fail "can't run to main" |
d11916aa SS |
42 | return 0 |
43 | } | |
44 | ||
45 | set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py] | |
46 | ||
47 | gdb_breakpoint [gdb_get_line_number "break backtrace-broken"] | |
48 | ||
49 | gdb_test "source ${pyfile}" "Python script imported" \ | |
50 | "import python scripts" | |
51 | ||
52 | gdb_continue_to_breakpoint "break backtrace-broken" | |
53 | gdb_test_sequence "where" "Backtrace restored by unwinder" { | |
54 | "\\r\\n#0 .* corrupt_frame_inner \\(\\) at " | |
55 | "\\r\\n#1 .* corrupt_frame_outer \\(\\) at " | |
56 | "\\r\\n#2 .* main \\(.*\\) at" | |
57 | } | |
58 | ||
8455d262 PA |
59 | # Check that the Python unwinder frames can be flushed / released. |
60 | gdb_test "flushregs" "Register cache flushed\\." "flush frames" |