OLD | NEW |
1 # Copyright 1999, 2001, 2004, 2006-2012 Free Software Foundation, Inc. | 1 # Copyright 1999-2013 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
| 16 # Test Machine interface (MI) operations |
16 # | 17 # |
17 # Test essential Machine interface (MI) operations | 18 # Test MI breakpoint commands. |
18 # | 19 # |
19 # Verify that, using the MI, we can run a simple program and perform basic | 20 # The goal is not to test gdb functionality, which is done by other |
20 # debugging activities like: insert breakpoints, run the program, | 21 # tests, but to verify the correct output response to MI operations. |
21 # step, next, continue until it ends and, last but not least, quit. | |
22 # | |
23 # The goal is not to test gdb functionality, which is done by other tests, | |
24 # but to verify the correct output response to MI operations. | |
25 # | |
26 | 22 |
27 load_lib mi-support.exp | 23 load_lib mi-support.exp |
28 set MIFLAGS "-i=mi" | 24 set MIFLAGS "-i=mi" |
29 | 25 |
30 gdb_exit | 26 gdb_exit |
31 if [mi_gdb_start] { | 27 if [mi_gdb_start] { |
32 continue | 28 continue |
33 } | 29 } |
34 | 30 |
35 standard_testfile basics.c | 31 standard_testfile basics.c |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 "insert temp breakpoint at basics.c:callee2" | 82 "insert temp breakpoint at basics.c:callee2" |
87 | 83 |
88 mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basic
s.c" $line_callee3_head $hex \ | 84 mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basic
s.c" $line_callee3_head $hex \ |
89 "insert temp breakpoint at basics.c:\$line_callee3_head" | 85 "insert temp breakpoint at basics.c:\$line_callee3_head" |
90 | 86 |
91 # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_he
ad" | 87 # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_he
ad" |
92 mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del ca
llee4 ".*basics.c" $line_callee4_head $hex \ | 88 mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del ca
llee4 ".*basics.c" $line_callee4_head $hex \ |
93 "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head" | 89 "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head" |
94 | 90 |
95 mi_gdb_test "666-break-list" \ | 91 mi_gdb_test "666-break-list" \ |
96 » "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\
{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Ty
pe\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\]
,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",add
r=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\
",times=\"0\",original-location=\".*\"\}.*\\\]\}" \ | 92 » "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\
{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Ty
pe\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\]
,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",add
r=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\
",thread-groups=\\\[\"i1\"\\\],times=\"0\",original-location=\".*\"\}.*\\\]\}" \ |
97 "list of breakpoints" | 93 "list of breakpoints" |
98 | 94 |
99 mi_gdb_test "777-break-delete" \ | 95 mi_gdb_test "777-break-delete" \ |
100 "777\\^done" \ | 96 "777\\^done" \ |
101 "delete temp breakpoints" | 97 "delete temp breakpoints" |
102 } | 98 } |
103 | 99 |
104 proc test_rbreak_creation_and_listing {} { | 100 proc test_rbreak_creation_and_listing {} { |
105 global mi_gdb_prompt | 101 global mi_gdb_prompt |
106 global srcfile | 102 global srcfile |
(...skipping 28 matching lines...) Expand all Loading... |
135 "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",li
ne=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\
",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basic
s.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*
basics.c\",line=\"$line_callee4_body\"\}" \ | 131 "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",li
ne=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\
",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basic
s.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*
basics.c\",line=\"$line_callee4_body\"\}" \ |
136 "insert breakpoint with regexp callee" | 132 "insert breakpoint with regexp callee" |
137 | 133 |
138 setup_kfail "*-*-*" mi/14270 | 134 setup_kfail "*-*-*" mi/14270 |
139 mi_gdb_test "155-break-insert -r \.\*llee" \ | 135 mi_gdb_test "155-break-insert -r \.\*llee" \ |
140 "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",l
ine=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.
c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*ba
sics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\
".*basics.c\",line=\"$line_callee4_body\"\}" \ | 136 "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",l
ine=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.
c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*ba
sics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\
".*basics.c\",line=\"$line_callee4_body\"\}" \ |
141 "insert breakpoint with regexp .*llee" | 137 "insert breakpoint with regexp .*llee" |
142 | 138 |
143 setup_kfail "*-*-*" mi/14270 | 139 setup_kfail "*-*-*" mi/14270 |
144 mi_gdb_test "166-break-list" \ | 140 mi_gdb_test "166-break-list" \ |
145 » "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{w
idth=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type
\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],b
ody=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr
=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"
\},.*\}\\\]\}" \ | 141 » "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{w
idth=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type
\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],b
ody=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr
=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",thread-grou
ps=\\\[\"i1\"\\\],times=\"0\"\},.*\}\\\]\}" \ |
146 "list of breakpoints" | 142 "list of breakpoints" |
147 | 143 |
148 mi_gdb_test "177-break-delete" \ | 144 mi_gdb_test "177-break-delete" \ |
149 "177\\^done" \ | 145 "177\\^done" \ |
150 "delete temp breakpoints" | 146 "delete temp breakpoints" |
151 } | 147 } |
152 | 148 |
| 149 proc test_abreak_creation {} { |
| 150 mi_create_varobj tpnum \$tpnum "create local variable tpnum" |
| 151 # Test that $tpnum is not set before creating a tracepoint. |
| 152 mi_gdb_test "521-var-evaluate-expression tpnum" \ |
| 153 "521\\^done,value=\"void\"" "eval tpnum before tracepoint" |
| 154 |
| 155 mi_gdb_test "522-break-insert -a main" \ |
| 156 "522\\^done,bkpt=\{number=\"10\",type=\"tracepoint\".*\"\}" \ |
| 157 "break-insert -a operation" |
| 158 |
| 159 mi_gdb_test "523-var-update tpnum" \ |
| 160 "523\\^done,changelist=\\\[\{name=\"tpnum\",in_scope=\"true\",type_chang
ed=\"false\",has_more=\"0\"\}\\\]" \ |
| 161 "update tpnum" |
| 162 # Test that $tpnum is updated after creating a tracepoint. |
| 163 mi_gdb_test "524-var-evaluate-expression tpnum" \ |
| 164 "524\\^done,value=\"10\"" "eval tpnum after tracepoint" |
| 165 } |
| 166 |
153 proc test_ignore_count {} { | 167 proc test_ignore_count {} { |
154 global mi_gdb_prompt | 168 global mi_gdb_prompt |
155 global line_callme_body | 169 global line_callme_body |
156 | 170 |
157 mi_gdb_test "-break-insert -i 1 callme" \ | 171 mi_gdb_test "-break-insert -i 1 callme" \ |
158 "\\^done.*ignore=\"1\".*" \ | 172 "\\^done.*ignore=\"1\".*" \ |
159 "insert breakpoint with ignore count at callme" | 173 "insert breakpoint with ignore count at callme" |
160 | 174 |
161 mi_run_cmd | 175 mi_run_cmd |
162 | 176 |
(...skipping 12 matching lines...) Expand all Loading... |
175 # clear some event hooks. As result, whenever we evaluate expression | 189 # clear some event hooks. As result, whenever we evaluate expression |
176 # containing function call, the internal breakpoint created to handle | 190 # containing function call, the internal breakpoint created to handle |
177 # function call would be reported, messing up MI output. | 191 # function call would be reported, messing up MI output. |
178 mi_gdb_test "-var-create V * return_1()" \ | 192 mi_gdb_test "-var-create V * return_1()" \ |
179 "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\",has_more=\"0
\"" \ | 193 "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\",has_more=\"0
\"" \ |
180 "create varobj for function call" | 194 "create varobj for function call" |
181 | 195 |
182 mi_gdb_test "-var-update *" \ | 196 mi_gdb_test "-var-update *" \ |
183 "\\^done,changelist=\\\[\\\]" \ | 197 "\\^done,changelist=\\\[\\\]" \ |
184 "update varobj for function call" | 198 "update varobj for function call" |
| 199 |
| 200 # Try setting breakpoints with garbage after the location. |
| 201 |
| 202 # "if" only works in the CLI. It's not supposed to be accepted by |
| 203 # MI. The way to specify a condition is with -c. |
| 204 mi_gdb_test "-break-insert \"callme if i < 4\"" \ |
| 205 ".*\\^error,msg=\"Garbage 'if i < 4' at end of location\"" \ |
| 206 "breakpoint with garbage after location" |
| 207 |
| 208 mi_gdb_test "-break-insert -c i==4 \"callme if i < 4\"" \ |
| 209 ".*\\^error,msg=\"Garbage 'if i < 4' at end of location\"" \ |
| 210 "conditional breakpoint with garbage after location" |
185 } | 211 } |
186 | 212 |
187 proc test_disabled_creation {} { | 213 proc test_disabled_creation {} { |
188 global mi_gdb_prompt | 214 global mi_gdb_prompt |
189 global hex | 215 global hex |
190 global line_callee2_body | 216 global line_callee2_body |
191 | 217 |
192 mi_gdb_test "-break-insert -d basics.c:callee2" \ | 218 mi_gdb_test "-break-insert -d basics.c:callee2" \ |
193 "\\^done,bkpt=\{number=\"6\",type=\"breakpoint\",disp=\"keep\",enabled=\
"n\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",fullname=\".*\",line=\"$
line_callee2_body\",times=\"0\",original-location=\".*\"\}" \ | 219 "\\^done,bkpt=\{number=\"6\",type=\"breakpoint\",disp=\"keep\",enabled=\
"n\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",fullname=\".*\",line=\"$
line_callee2_body\",thread-groups=\\\[\"i1\"\\\],times=\"0\",original-location=\
".*\"\}" \ |
194 "test disabled creation" | 220 "test disabled creation" |
195 | 221 |
196 mi_gdb_test "-break-delete" \ | 222 mi_gdb_test "-break-delete" \ |
197 "\\^done" \ | 223 "\\^done" \ |
198 "test disabled creation: cleanup" | 224 "test disabled creation: cleanup" |
199 } | 225 } |
200 | 226 |
201 proc test_breakpoint_commands {} { | 227 proc test_breakpoint_commands {} { |
202 global line_callee2_body | 228 global line_callee2_body |
203 global hex | 229 global hex |
204 global fullname | 230 global fullname |
205 | 231 |
206 mi_create_breakpoint "basics.c:callee2" 7 keep callee2 ".*basics.c" $line_ca
llee2_body $hex \ | 232 mi_create_breakpoint "basics.c:callee2" 7 keep callee2 ".*basics.c" $line_ca
llee2_body $hex \ |
207 "breakpoint commands: insert breakpoint at basics.c:callee2" | 233 "breakpoint commands: insert breakpoint at basics.c:callee2" |
208 | 234 |
209 mi_gdb_test "-break-commands 7 \"print 10\" \"continue\"" \ | 235 mi_gdb_test "-break-commands 7 \"print 10\" \"continue\"" \ |
210 "\\^done" \ | 236 "\\^done" \ |
211 "breakpoint commands: set commands" | 237 "breakpoint commands: set commands" |
212 | 238 |
213 mi_gdb_test "-break-info 7" \ | 239 mi_gdb_test "-break-info 7" \ |
214 » "\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\
".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*co
lhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\
\[bkpt=\{number=\"7\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$he
x\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"
,times=\"0\",script=\{\"print 10\",\"continue\"\},original-location=\".*\"\}.*\\
\]\}" \ | 240 » "\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\
".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*co
lhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\
\[bkpt=\{number=\"7\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$he
x\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"
,thread-groups=\\\[\"i1\"\\\],times=\"0\",script=\{\"print 10\",\"continue\"\},o
riginal-location=\".*\"\}.*\\\]\}" \ |
215 "breakpoint commands: check that commands are set" | 241 "breakpoint commands: check that commands are set" |
216 | 242 |
217 mi_gdb_test "-break-commands 7" \ | 243 mi_gdb_test "-break-commands 7" \ |
218 "\\^done" \ | 244 "\\^done" \ |
219 "breakpoint commands: clear commands" | 245 "breakpoint commands: clear commands" |
220 | 246 |
221 mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2
_body" $hex]] \ | 247 mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2
_body" $hex]] \ |
222 "breakpoint commands: check that commands are cleared" | 248 "breakpoint commands: check that commands are cleared" |
223 | 249 |
224 mi_run_to_main | 250 mi_run_to_main |
(...skipping 24 matching lines...) Expand all Loading... |
249 test_rbreak_creation_and_listing | 275 test_rbreak_creation_and_listing |
250 | 276 |
251 test_ignore_count | 277 test_ignore_count |
252 | 278 |
253 test_error | 279 test_error |
254 | 280 |
255 test_disabled_creation | 281 test_disabled_creation |
256 | 282 |
257 test_breakpoint_commands | 283 test_breakpoint_commands |
258 | 284 |
| 285 test_abreak_creation |
| 286 |
259 mi_gdb_exit | 287 mi_gdb_exit |
260 return 0 | 288 return 0 |
OLD | NEW |