Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2013-2015 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 | ||
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 "Could not compile either $libsrc or $srcdir/$subdir/$srcfile." | |
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 \ | |
45 | "dprintf pendfunc" \ | |
46 | "Dprintf.*pendfunc.*pending." \ | |
47 | "set pending dprintf" \ | |
48 | ".*Make dprintf pending.*y or \\\[n\\\]. $" \ | |
49 | "y" | |
50 | ||
51 | gdb_test "file ${binfile}" ".*Error in re-setting breakpoint.*" "resolved dprintf fails to be re-set" | |
52 | } | |
53 | ||
54 | with_test_prefix "without symbols" { | |
55 | gdb_exit | |
56 | gdb_start | |
57 | gdb_reinitialize_dir $srcdir/$subdir | |
58 | ||
59 | gdb_test \ | |
60 | "dprintf pendfunc1, \"x=%d\\n\", x" \ | |
61 | "Dprintf.*pendfunc1.*pending." \ | |
62 | "set pending dprintf" \ | |
63 | ".*Make dprintf pending.*y or \\\[n\\\]. $" \ | |
64 | "y" | |
65 | ||
66 | gdb_test "info break" \ | |
67 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
68 | \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \ | |
69 | "single pending dprintf info" | |
70 | ||
71 | gdb_load ${binfile} | |
72 | gdb_load_shlibs $lib_sl | |
73 | ||
74 | gdb_run_cmd | |
75 | ||
76 | gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" | |
77 | } | |
78 | ||
79 | clean_restart ${binfile} | |
80 | gdb_load_shlibs $lib_sl | |
81 | ||
82 | # | |
83 | # Test setting, querying, and modifying pending breakpoints | |
84 | # | |
85 | ||
86 | gdb_test \ | |
87 | "dprintf pendfunc1, \"x=%d\\n\", x" \ | |
88 | "Dprintf.*pendfunc1.*pending." \ | |
89 | "set pending dprintf" \ | |
90 | ".*Make dprintf pending.*y or \\\[n\\\]. $" \ | |
91 | "y" | |
92 | ||
93 | gdb_test "info break" \ | |
94 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
95 | \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \ | |
96 | "single pending dprintf info" | |
97 | ||
98 | gdb_run_cmd | |
99 | ||
100 | gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" |