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