]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/dprintf-pending.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / dprintf-pending.exp
CommitLineData
1d506c26 1# Copyright 2013-2024 Free Software Foundation, Inc.
5c2b4418
HZ
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
d6195dc9 17require allow_shlib_tests
5c2b4418
HZ
18
19standard_testfile
20set libfile "dprintf-pendshr"
21set libsrc $srcdir/$subdir/$libfile.c
22set lib_sl [standard_output_file $libfile.sl]
23
24set lib_opts debug
25set exec_opts [list debug shlib=$lib_sl]
26
5c2b4418
HZ
27if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
28 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
84c93cd5 29 untested "failed to compile shared library"
5c2b4418
HZ
30 return -1
31}
32
33with_test_prefix "without format" {
c95d486d 34 clean_restart
5c2b4418 35
f00aae0f
KS
36 gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT"
37 gdb_test "dprintf pendfunc," "Format string required" "missing FMT"
5c2b4418
HZ
38}
39
40with_test_prefix "without symbols" {
c95d486d 41 clean_restart
5c2b4418
HZ
42
43 gdb_test \
44 "dprintf pendfunc1, \"x=%d\\n\", x" \
45 "Dprintf.*pendfunc1.*pending." \
46 "set pending dprintf" \
47 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
48 "y"
49
50 gdb_test "info break" \
51 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
52\[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \
53 "single pending dprintf info"
54
55 gdb_load ${binfile}
d9019901 56 gdb_load_shlib $lib_sl
5c2b4418
HZ
57
58 gdb_run_cmd
59
60 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"
61}
62
63clean_restart ${binfile}
d9019901 64gdb_load_shlib $lib_sl
5c2b4418
HZ
65
66#
67# Test setting, querying, and modifying pending breakpoints
68#
69
70gdb_test \
71 "dprintf pendfunc1, \"x=%d\\n\", x" \
72 "Dprintf.*pendfunc1.*pending." \
73 "set pending dprintf" \
74 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
75 "y"
76
77gdb_test "info break" \
78 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
79\[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \
80"single pending dprintf info"
81
82gdb_run_cmd
83
84gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"