xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.mi/mi-pending.exp (revision b83ebeba7f767758d2778bb0f9d7a76534253621)
1# Copyright 2007-2015 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
16load_lib mi-support.exp
17set MIFLAGS "-i=mi"
18
19#
20# test running programs
21#
22
23if {[skip_shlib_tests]} {
24    return 0
25}
26
27standard_testfile mi-pending.c mi-pendshr.c
28set lib_sl [standard_output_file mi-pendshr.sl]
29
30set lib_opts  debug
31set exec_opts [list debug shlib=$lib_sl]
32
33if [get_compiler_info] {
34    return -1
35}
36
37if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $lib_sl $lib_opts] != ""
38     || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
39    untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
40    return -1
41}
42
43# Start with a fresh gdb.
44
45gdb_exit
46mi_gdb_start
47mi_gdb_reinitialize_dir $srcdir/$subdir
48mi_gdb_load ${binfile}
49mi_load_shlibs $lib_sl
50
51# Set pending breakpoint via MI.
52mi_gdb_test "-break-insert -f pendfunc1" \
53    ".*\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"\}"\
54    "MI pending breakpoint on pendfunc1"
55
56# Set pending breakpoint with a condition via MI.
57mi_gdb_test "-break-insert -f -c x==4 ${srcfile2}:pendfunc2" \
58    ".*\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"${srcfile2}:pendfunc2\",cond=\"x==4\",times=\"0\",original-location=\"${srcfile2}:pendfunc2\"\}"\
59    "MI pending breakpoint on ${srcfile2}:pendfunc2 if x==4"
60
61mi_run_cmd
62mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
63    { "" "disp=\"keep\"" } \
64    "Run till MI pending breakpoint on pendfunc1"
65
66mi_send_resuming_command "exec-continue" "continuing execution to skip conditional bp"
67# We should not stop on the conditional breakpoint yet, but we stop on the original bp.
68mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
69    { "" "disp=\"keep\"" } \
70    "Run till MI pending breakpoint on pendfunc1 a second time"
71
72mi_send_resuming_command "exec-continue" "continuing execution to conditional bp"
73# Now we should stop on the conditional breakpoint.
74mi_expect_stop "breakpoint-hit" "pendfunc2" "\{name=\"x\",value=\"4\"\}" ".*" ".*" \
75    { "" "disp=\"keep\"" } \
76    "Run till MI pending breakpoint on pendfunc2 with x==4"
77