]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-pending.exp
5f82dbfdc2f6d81ff3415e52f3bb40ccafd4ab44
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-pending.exp
1 # Copyright 2007-2014 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
16 load_lib mi-support.exp
17 set MIFLAGS "-i=mi"
18
19 #
20 # test running programs
21 #
22
23 if {[skip_shlib_tests]} {
24 return 0
25 }
26
27 standard_testfile mi-pending.c mi-pendshr.c
28 set lib_sl [standard_output_file mi-pendshr.sl]
29
30 set lib_opts debug
31 set exec_opts [list debug shlib=$lib_sl]
32
33 if [get_compiler_info] {
34 return -1
35 }
36
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."
40 return -1
41 }
42
43 # Start with a fresh gdb.
44
45 gdb_exit
46 mi_gdb_start
47 mi_gdb_reinitialize_dir $srcdir/$subdir
48 mi_gdb_load ${binfile}
49 mi_load_shlibs $lib_sl
50
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"
55
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"
60
61 mi_run_cmd
62 mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
63 { "" "disp=\"keep\"" } \
64 "Run till MI pending breakpoint on pendfunc1"
65
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"
71
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"