1 # Copyright (C) 2015-2018 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 tests Python-based
19 load_lib gdb-python.exp
23 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
27 # Skip all tests if Python scripting is not enabled.
28 if { [skip_python_tests] } { continue }
30 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
32 if ![runto_main ] then {
33 fail "can't run to main"
37 gdb_test "source ${pyfile}" "Python script imported" \
38 "import python scripts"
40 gdb_test_sequence "frame" "All unwinders enabled" {
41 "py_unwind_maint_ps_unwinder called"
42 "global_unwinder called"
46 gdb_test_sequence "info unwinder" "Show all unwinders" {
49 "Progspace .*py-unwind-maint:"
50 "py_unwind_maint_ps_unwinder"
53 gdb_breakpoint ${srcfile}:[gdb_get_line_number "next-line"]
55 gdb_test_sequence "continue" "Unwinders called" {
56 "py_unwind_maint_ps_unwinder called"
57 "global_unwinder called"
60 gdb_test_sequence "disable unwinder global .*" "Unwinder disabled" {
64 gdb_test_sequence "info unwinder" "Show with global unwinder disabled" {
66 " global_unwinder \\[disabled\\]"
67 "Progspace .*py-unwind-maint:"
68 " py_unwind_maint_ps_unwinder"
71 gdb_test_sequence "where" "Global unwinder disabled" {
72 "py_unwind_maint_ps_unwinder called\r\n#0 main"