Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright (C) 2015-2016 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 tests Python-based | |
17 | # unwinding CLI. | |
18 | ||
19 | load_lib gdb-python.exp | |
20 | ||
21 | standard_testfile | |
22 | ||
23 | if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { | |
24 | return -1 | |
25 | } | |
26 | ||
27 | # Skip all tests if Python scripting is not enabled. | |
28 | if { [skip_python_tests] } { continue } | |
29 | ||
30 | set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py] | |
31 | ||
32 | if ![runto_main ] then { | |
33 | fail "Can't run to main" | |
34 | return -1 | |
35 | } | |
36 | ||
37 | gdb_test "source ${pyfile}" "Python script imported" "import python scripts" | |
38 | ||
39 | gdb_test_sequence "info unwinder" "Show all unwinders" { | |
40 | "Global:" | |
41 | " global_unwinder" | |
42 | "Progspace .*py-unwind-maint:" | |
43 | "py_unwind_maint_ps_unwinder" | |
44 | } | |
45 | ||
46 | gdb_breakpoint ${srcfile}:[gdb_get_line_number "next-line"] | |
47 | ||
48 | gdb_test_sequence "continue" "Unwinders called" { | |
49 | "py_unwind_maint_ps_unwinder called" | |
50 | "global_unwinder called" | |
51 | } | |
52 | ||
53 | gdb_test "disable unwinder global .*" "1 unwinder disabled" "Unwinder disabled" | |
54 | ||
55 | gdb_test_sequence "info unwinder" "Show with global unwinder disabled" { | |
56 | "Global:" | |
57 | " global_unwinder \\[disabled\\]" | |
58 | "Progspace .*py-unwind-maint:" | |
59 | " py_unwind_maint_ps_unwinder" | |
60 | } | |
61 | ||
62 | gdb_test_sequence "where" "Global unwinder disabled" { | |
63 | "py_unwind_maint_ps_unwinder called\r\n#0 main" | |
64 | } |