]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.python/py-rbreak.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-rbreak.exp
CommitLineData
1d506c26 1# Copyright (C) 2017-2024 Free Software Foundation, Inc.
d8ae99a7
PM
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
d82e5429 21require allow_python_tests
79749205 22
d8ae99a7
PM
23standard_testfile py-rbreak.c py-rbreak-func2.c
24
25if {[prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
26 return 1
27}
28
b0e16ca5 29if {![runto_main]} {
d8ae99a7
PM
30 return 0
31}
32
f6f1d339 33gdb_test_no_output "nosharedlibrary"
9f82823f 34gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"\",minsyms=False)" \
d8ae99a7 35 "get all function breakpoints" 0
9f82823f
TV
36set min_breakpoints 11
37gdb_test_multiple "py print(len(sl))" \
38 "check number of returned breakpoints is at least $min_breakpoints" {
39 -re -wrap "($decimal)" {
40 set n $expect_out(1,string)
41 gdb_assert { $n >= $min_breakpoints } $gdb_test_name
42 }
43 }
d8ae99a7
PM
44gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"main\.\*\",minsyms=False)" \
45 "get main function breakpoint" 0
46gdb_test "py print(len(sl))" "1" \
47 "check number of returned breakpoints is 1"
48gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10)" \
49 "get functions matching func.*" 0
50gdb_test "py print(len(sl))" "9" \
51 "check number of returned breakpoints is 9"
52gdb_test "py gdb.rbreak(\"func\.\*\",minsyms=False,throttle=5)" \
53 "Number of breakpoints exceeds throttled maximum.*" \
54 "check throttle errors on too many breakpoints"
55gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func1\",minsyms=True)" \
56 "including minimal symbols, get functions matching func.*" 0
57gdb_test "py print(len(sl))" "2" \
58 "check number of returned breakpoints is 2"
59gdb_py_test_silent_cmd "python sym = gdb.lookup_symbol(\"efunc1\")" \
60 "find a symbol in objfile" 1
61gdb_py_test_silent_cmd "python symtab = sym\[0\].symtab" \
62 "get backing symbol table" 1
63gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10,symtabs=\[symtab\])" \
64 "get functions matching func.* in one symtab only" 0
65gdb_test "py print(len(sl))" "3" \
66 "check number of returned breakpoints is 3"