]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.python/py-caller-is.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-caller-is.exp
CommitLineData
1d506c26 1# Copyright (C) 2012-2024 Free Software Foundation, Inc.
faa42425
DE
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 convenience
17# functions in caller_is.py.
18
19load_lib gdb-python.exp
20
d82e5429 21require allow_python_tests
79749205 22
faa42425
DE
23standard_testfile
24
5b362f04 25if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
faa42425
DE
26 return -1
27}
28
29if ![runto_main] {
30 return 0
31}
32
faa42425
DE
33gdb_breakpoint "bottom_func"
34gdb_continue_to_breakpoint "bottom_func"
35
36proc test_all_caller_is_fns { } {
37 gdb_test "p \$_caller_is (\"bottom_func\", 0)" " = 1"
38 gdb_test "p \$_caller_is (\"middle_func\")" " = 1"
39 gdb_test "p \$_caller_is (\"top_func\")" " = 0"
40 gdb_test "p \$_caller_is (\"middle_func\", 2)" " = 0"
41 gdb_test "p \$_caller_is (\"top_func\", 2)" " = 1"
42 gdb_test "p \$_caller_is (\"foo\", 100)" " = 0"
43 gdb_test "p \$_caller_is (\"foo\", -1)" "nframes must be >= 0"
44
45 gdb_test "p \$_caller_matches (\"^bottom\", 0)" " = 1"
46 gdb_test "p \$_caller_matches (\"^middle_\")" " = 1"
47 gdb_test "p \$_caller_matches (\"^top_\")" " = 0"
48 gdb_test "p \$_caller_matches (\"^middle_\", 2)" " = 0"
49 gdb_test "p \$_caller_matches (\"^top_f\", 2)" " = 1"
50 gdb_test "p \$_caller_matches (\"foo\", 100)" " = 0"
51 gdb_test "p \$_caller_matches (\"foo\", -1)" "nframes must be >= 0"
52
53 gdb_test "p \$_any_caller_is (\"bottom_func\", 0)" " = 1"
54 gdb_test "p \$_any_caller_is (\"middle_func\")" " = 1"
55 gdb_test "p \$_any_caller_is (\"top_func\")" " = 0"
56 gdb_test "p \$_any_caller_is (\"middle_func\", 2)" " = 1"
57 gdb_test "p \$_any_caller_is (\"top_func\", 2)" " = 1"
58 gdb_test "p \$_any_caller_is (\"main\", 100)" " = 1"
59 gdb_test "p \$_any_caller_is (\"foo\", 100)" " = 0"
60 gdb_test "p \$_any_caller_is (\"foo\", -1)" "nframes must be >= 0"
61
62 gdb_test "p \$_any_caller_matches (\"^bottom\", 0)" " = 1"
63 gdb_test "p \$_any_caller_matches (\"^middle_\")" " = 1"
64 gdb_test "p \$_any_caller_matches (\"^top_\")" " = 0"
65 gdb_test "p \$_any_caller_matches (\"^middle_\", 2)" " = 1"
66 gdb_test "p \$_any_caller_matches (\"^top_f\", 2)" " = 1"
67 gdb_test "p \$_any_caller_matches (\"^main\", 100)" " = 1"
68 gdb_test "p \$_any_caller_matches (\"foo\", 100)" " = 0"
69 gdb_test "p \$_any_caller_matches (\"foo\", -1)" "nframes must be >= 0"
70}
71
72test_all_caller_is_fns