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