]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2013-2023 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 | ||
5c2b4418 HZ |
29 | if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != "" |
30 | || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} { | |
84c93cd5 | 31 | untested "failed to compile shared library" |
5c2b4418 HZ |
32 | return -1 |
33 | } | |
34 | ||
35 | with_test_prefix "without format" { | |
36 | gdb_exit | |
37 | gdb_start | |
38 | gdb_reinitialize_dir $srcdir/$subdir | |
39 | ||
f00aae0f KS |
40 | gdb_test "dprintf pendfunc" "Format string required" "missing ,FMT" |
41 | gdb_test "dprintf pendfunc," "Format string required" "missing FMT" | |
5c2b4418 HZ |
42 | } |
43 | ||
44 | with_test_prefix "without symbols" { | |
45 | gdb_exit | |
46 | gdb_start | |
47 | gdb_reinitialize_dir $srcdir/$subdir | |
48 | ||
49 | gdb_test \ | |
50 | "dprintf pendfunc1, \"x=%d\\n\", x" \ | |
51 | "Dprintf.*pendfunc1.*pending." \ | |
52 | "set pending dprintf" \ | |
53 | ".*Make dprintf pending.*y or \\\[n\\\]. $" \ | |
54 | "y" | |
55 | ||
56 | gdb_test "info break" \ | |
57 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
58 | \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \ | |
59 | "single pending dprintf info" | |
60 | ||
61 | gdb_load ${binfile} | |
d9019901 | 62 | gdb_load_shlib $lib_sl |
5c2b4418 HZ |
63 | |
64 | gdb_run_cmd | |
65 | ||
66 | gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" | |
67 | } | |
68 | ||
69 | clean_restart ${binfile} | |
d9019901 | 70 | gdb_load_shlib $lib_sl |
5c2b4418 HZ |
71 | |
72 | # | |
73 | # Test setting, querying, and modifying pending breakpoints | |
74 | # | |
75 | ||
76 | gdb_test \ | |
77 | "dprintf pendfunc1, \"x=%d\\n\", x" \ | |
78 | "Dprintf.*pendfunc1.*pending." \ | |
79 | "set pending dprintf" \ | |
80 | ".*Make dprintf pending.*y or \\\[n\\\]. $" \ | |
81 | "y" | |
82 | ||
83 | gdb_test "info break" \ | |
84 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
85 | \[0-9\]+\[\t \]+dprintf.*keep y.*PENDING.*pendfunc1.*" \ | |
86 | "single pending dprintf info" | |
87 | ||
88 | gdb_run_cmd | |
89 | ||
90 | gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf" |