1 # Copyright 2013-2024 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/>.
17 require allow_shlib_tests
20 set libfile "dprintf-pendshr"
21 set libsrc $srcdir/$subdir/$libfile.c
22 set lib_sl [standard_output_file $libfile.sl]
25 set exec_opts [list debug shlib=$lib_sl]
27 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
28 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
29 untested "failed to compile shared library"
33 with_test_prefix "without format" {
36 gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT"
37 gdb_test "dprintf pendfunc," "Format string required" "missing FMT"
40 with_test_prefix "without symbols" {
44 "dprintf pendfunc1, \"x=%d\\n\", x" \
45 "Dprintf.*pendfunc1.*pending." \
46 "set pending dprintf" \
47 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
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"
56 gdb_load_shlib $lib_sl
60 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"
63 clean_restart ${binfile}
64 gdb_load_shlib $lib_sl
67 # Test setting, querying, and modifying pending breakpoints
71 "dprintf pendfunc1, \"x=%d\\n\", x" \
72 "Dprintf.*pendfunc1.*pending." \
73 "set pending dprintf" \
74 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
77 gdb_test "info break" \
78 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
79 \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \
80 "single pending dprintf info"
84 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"