1 # Copyright (C) 2015-2024 Free Software Foundation, Inc. 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 require allow_python_tests 22 23 standard_testfile 24 25 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { 26 return -1 27 } 28 29 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py] 30 31 if {![runto_main]} { 32 return -1 33 } 34 35 gdb_test "source ${pyfile}" "Python script imported" \ 36 "import python scripts" 37 38 gdb_test_sequence "frame" "All unwinders enabled" { 39 "py_unwind_maint_ps_unwinder called" 40 "global_unwinder called" 41 "#0 main" 42 } 43 44 gdb_test_sequence "info unwinder" "Show all unwinders" { 45 "Global:" 46 " global_unwinder" 47 "Progspace .*py-unwind-maint:" 48 "py_unwind_maint_ps_unwinder" 49 } 50 51 gdb_breakpoint ${srcfile}:[gdb_get_line_number "next-line"] 52 53 gdb_test_sequence "continue" "Unwinders called" { 54 "py_unwind_maint_ps_unwinder called" 55 "global_unwinder called" 56 } 57 58 gdb_test_sequence "disable unwinder global .*" "Unwinder disabled" { 59 "1 unwinder disabled" 60 } 61 62 gdb_test_sequence "info unwinder" "Show with global unwinder disabled" { 63 "Global:" 64 " global_unwinder \\[disabled\\]" 65 "Progspace .*py-unwind-maint:" 66 " py_unwind_maint_ps_unwinder" 67 } 68 69 gdb_test_sequence "where" "Global unwinder disabled" { 70 "py_unwind_maint_ps_unwinder called\r\n#0 main" 71 } 72