1# Copyright 2013-2019 Free Software Foundation, Inc. 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 17if {[skip_shlib_tests]} { 18 return 0 19} 20 21standard_testfile 22set libfile "dprintf-pendshr" 23set libsrc $srcdir/$subdir/$libfile.c 24set lib_sl [standard_output_file $libfile.sl] 25 26set lib_opts debug 27set exec_opts [list debug shlib=$lib_sl] 28 29if { [get_compiler_info] } { 30 return -1 31} 32 33if { [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" 36 return -1 37} 38 39with_test_prefix "without format" { 40 gdb_exit 41 gdb_start 42 gdb_reinitialize_dir $srcdir/$subdir 43 44 gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT" 45 gdb_test "dprintf pendfunc," "Format string required" "missing FMT" 46} 47 48with_test_prefix "without symbols" { 49 gdb_exit 50 gdb_start 51 gdb_reinitialize_dir $srcdir/$subdir 52 53 gdb_test \ 54 "dprintf pendfunc1, \"x=%d\\n\", x" \ 55 "Dprintf.*pendfunc1.*pending." \ 56 "set pending dprintf" \ 57 ".*Make dprintf pending.*y or \\\[n\\\]. $" \ 58 "y" 59 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" 64 65 gdb_load ${binfile} 66 gdb_load_shlib $lib_sl 67 68 gdb_run_cmd 69 70 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" 71} 72 73clean_restart ${binfile} 74gdb_load_shlib $lib_sl 75 76# 77# Test setting, querying, and modifying pending breakpoints 78# 79 80gdb_test \ 81 "dprintf pendfunc1, \"x=%d\\n\", x" \ 82 "Dprintf.*pendfunc1.*pending." \ 83 "set pending dprintf" \ 84 ".*Make dprintf pending.*y or \\\[n\\\]. $" \ 85 "y" 86 87gdb_test "info break" \ 88 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 89\[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \ 90"single pending dprintf info" 91 92gdb_run_cmd 93 94gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" 95