1# Copyright (C) 2017-2019 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 the mechanism 17# exposing values to Python. 18 19load_lib gdb-python.exp 20 21standard_testfile py-rbreak.c py-rbreak-func2.c 22 23if {[prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } { 24 return 1 25} 26 27# Skip all tests if Python scripting is not enabled. 28if { [skip_python_tests] } { continue } 29 30if ![runto_main] then { 31 fail "can't run to main" 32 return 0 33} 34 35gdb_test_no_output "nosharedlibrary" 36gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"^\[^_\]\",minsyms=False)" \ 37 "get all function breakpoints" 0 38gdb_test "py print(len(sl))" "11" \ 39 "check number of returned breakpoints is 11" 40gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"main\.\*\",minsyms=False)" \ 41 "get main function breakpoint" 0 42gdb_test "py print(len(sl))" "1" \ 43 "check number of returned breakpoints is 1" 44gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10)" \ 45 "get functions matching func.*" 0 46gdb_test "py print(len(sl))" "9" \ 47 "check number of returned breakpoints is 9" 48gdb_test "py gdb.rbreak(\"func\.\*\",minsyms=False,throttle=5)" \ 49 "Number of breakpoints exceeds throttled maximum.*" \ 50 "check throttle errors on too many breakpoints" 51gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func1\",minsyms=True)" \ 52 "including minimal symbols, get functions matching func.*" 0 53gdb_test "py print(len(sl))" "2" \ 54 "check number of returned breakpoints is 2" 55gdb_py_test_silent_cmd "python sym = gdb.lookup_symbol(\"efunc1\")" \ 56 "find a symbol in objfile" 1 57gdb_py_test_silent_cmd "python symtab = sym\[0\].symtab" \ 58 "get backing symbol table" 1 59gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10,symtabs=\[symtab\])" \ 60 "get functions matching func.* in one symtab only" 0 61gdb_test "py print(len(sl))" "3" \ 62 "check number of returned breakpoints is 3" 63