Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2015-2020 Free Software Foundation, Inc. |
98aa42ee AT |
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 | # This test checks if dprintf prints correctly when it's resolved from | |
17 | # pending state. | |
18 | # See PR breakpoints/16465. | |
19 | ||
20 | load_lib mi-support.exp | |
21 | ||
22 | if {[skip_shlib_tests]} { | |
23 | return 0 | |
24 | } | |
25 | ||
26 | standard_testfile mi-dprintf-pending.c | |
27 | ||
28 | set libfile1 "mi-dprintf-pendshr" | |
29 | set libsrc1 $srcdir/$subdir/$libfile1.c | |
30 | set lib_sl1 [standard_output_file $libfile1.sl] | |
31 | set lib_opts debug | |
32 | set exec_opts [list debug shlib=$lib_sl1 shlib_load] | |
33 | ||
34 | if {[get_compiler_info]} { | |
35 | return -1 | |
36 | } | |
37 | ||
38 | if {[gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != ""} { | |
84c93cd5 | 39 | untested "failed to compile shared library" |
98aa42ee AT |
40 | return -1 |
41 | } | |
42 | ||
43 | if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} { | |
84c93cd5 | 44 | untested "failed to compile" |
98aa42ee AT |
45 | return -1 |
46 | } | |
47 | ||
48 | # Start with a fresh gdb. | |
49 | gdb_exit | |
50 | mi_gdb_start | |
51 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
52 | mi_gdb_load ${binfile} | |
53 | mi_load_shlibs $lib_sl1 | |
54 | ||
55 | set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] | |
56 | ||
57 | # Set pending dprintf via MI. | |
58 | mi_gdb_test "-dprintf-insert -f pendfunc1 \"hello\"" \ | |
59 | ".*\\^done,bkpt={number=\"1\",type=\"dprintf\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"}" \ | |
60 | "mi set dprintf" | |
61 | ||
62 | mi_create_breakpoint $bp_location1 "mi insert breakpoint bp_location1" \ | |
3f469b17 | 63 | -type "breakpoint" -line $bp_location1 -file ".*$srcfile" |
98aa42ee AT |
64 | |
65 | mi_run_cmd | |
66 | ||
67 | set msg "mi dprintf" | |
68 | gdb_expect { | |
69 | -re ".*~\"hello\"" { | |
70 | pass $msg | |
71 | } | |
72 | -re ".*$mi_gdb_prompt$" { | |
73 | fail $msg | |
74 | } | |
75 | timeout { | |
76 | fail $msg | |
77 | } | |
78 | } | |
79 | mi_expect_stop ".*" "main" ".*" ".*$srcfile" "$bp_location1" "" "$msg stop" |