Fixup testcases outputting own name as a test name and standardize failed compilation...
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / dprintf-pending.exp
1 # Copyright 2013-2016 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
17 if {[skip_shlib_tests]} {
18 return 0
19 }
20
21 standard_testfile
22 set libfile "dprintf-pendshr"
23 set libsrc $srcdir/$subdir/$libfile.c
24 set lib_sl [standard_output_file $libfile.sl]
25
26 set lib_opts debug
27 set exec_opts [list debug shlib=$lib_sl]
28
29 if { [get_compiler_info] } {
30 return -1
31 }
32
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"
36 return -1
37 }
38
39 with_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
48 with_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
73 clean_restart ${binfile}
74 gdb_load_shlib $lib_sl
75
76 #
77 # Test setting, querying, and modifying pending breakpoints
78 #
79
80 gdb_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
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"
91
92 gdb_run_cmd
93
94 gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"
This page took 0.031412 seconds and 4 git commands to generate.