1 # Copyright 2013-2019 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 if {[skip_shlib_tests]} {
22 set libfile "dprintf-pendshr"
23 set libsrc $srcdir/$subdir/$libfile.c
24 set lib_sl [standard_output_file $libfile.sl]
27 set exec_opts [list debug shlib=$lib_sl]
29 if { [get_compiler_info] } {
33 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
34 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
35 untested "failed to compile shared library"
39 with_test_prefix "without format" {
42 gdb_reinitialize_dir $srcdir/$subdir
44 gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT"
45 gdb_test "dprintf pendfunc," "Format string required" "missing FMT"
48 with_test_prefix "without symbols" {
51 gdb_reinitialize_dir $srcdir/$subdir
54 "dprintf pendfunc1, \"x=%d\\n\", x" \
55 "Dprintf.*pendfunc1.*pending." \
56 "set pending dprintf" \
57 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
60 gdb_test "info break" \
61 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
62 \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \
63 "single pending dprintf info"
66 gdb_load_shlib $lib_sl
70 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"
73 clean_restart ${binfile}
74 gdb_load_shlib $lib_sl
77 # Test setting, querying, and modifying pending breakpoints
81 "dprintf pendfunc1, \"x=%d\\n\", x" \
82 "Dprintf.*pendfunc1.*pending." \
83 "set pending dprintf" \
84 ".*Make dprintf pending.*y or \\\[n\\\]. $" \
87 gdb_test "info break" \
88 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
89 \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \
90 "single pending dprintf info"
94 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"