1 # Copyright 2007-2012 Free Software Foundation, Inc.
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.
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.
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/>.
16 load_lib mi-support.exp
20 # test running programs
23 if {[skip_shlib_tests]} {
27 standard_testfile mi-pending.c mi-pendshr.c
28 set lib_sl [standard_output_file mi-pendshr.sl]
31 set exec_opts [list debug shlib=$lib_sl]
33 if [get_compiler_info] {
37 if { [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."
43 # Start with a fresh gdb.
47 mi_gdb_reinitialize_dir $srcdir/$subdir
48 mi_gdb_load ${binfile}
49 mi_load_shlibs $lib_sl
51 # Set pending breakpoint via MI.
52 mi_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"
56 # Set pending breakpoint with a condition via MI.
57 mi_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"
62 mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
63 { "" "disp=\"keep\"" } \
64 "Run till MI pending breakpoint on pendfunc1"
66 mi_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.
68 mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
69 { "" "disp=\"keep\"" } \
70 "Run till MI pending breakpoint on pendfunc1 a second time"
72 mi_send_resuming_command "exec-continue" "continuing execution to conditional bp"
73 # Now we should stop on the conditional breakpoint.
74 mi_expect_stop "breakpoint-hit" "pendfunc2" "\{name=\"x\",value=\"4\"\}" ".*" ".*" \
75 { "" "disp=\"keep\"" } \
76 "Run till MI pending breakpoint on pendfunc2 with x==4"