Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright 2013-2014 Free Software Foundation, Inc. |
bc5065a7 PA |
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 | # Execute command CMD and check that GDB sends the expected number of | |
db1ac436 YQ |
17 | # vCont;s and vCont;r packets. Returns 0 if the test passes, |
18 | # otherwise returns 1. | |
bc5065a7 PA |
19 | |
20 | proc exec_cmd_expect_vCont_count { cmd exp_vCont_s exp_vCont_r } { | |
21 | global gdb_prompt | |
22 | ||
23 | gdb_test_no_output "set debug remote 1" "" | |
24 | ||
25 | set test "${cmd}: vCont;s=${exp_vCont_s} vCont;r=${exp_vCont_r}" | |
26 | set r_counter 0 | |
27 | set s_counter 0 | |
db1ac436 | 28 | set ret 1 |
bc5065a7 PA |
29 | gdb_test_multiple $cmd $test { |
30 | -re "vCont;s\[^\r\n\]*Packet received: T\[\[:xdigit:\]\]\[\[:xdigit:\]\]" { | |
31 | incr s_counter | |
32 | exp_continue | |
33 | } | |
34 | -re "vCont;r\[^\r\n\]*Packet received: T\[\[:xdigit:\]\]\[\[:xdigit:\]\]" { | |
35 | incr r_counter | |
36 | exp_continue | |
37 | } | |
38 | -re "\r\n" { | |
39 | # Prevent overflowing the expect buffer. | |
40 | exp_continue | |
41 | } | |
42 | -re "$gdb_prompt $" { | |
43 | if { $r_counter == ${exp_vCont_r} && $s_counter == ${exp_vCont_s} } { | |
44 | pass $test | |
db1ac436 | 45 | set ret 0 |
bc5065a7 PA |
46 | } else { |
47 | fail $test | |
48 | } | |
49 | } | |
50 | } | |
51 | ||
52 | gdb_test_no_output "set debug remote 0" "" | |
db1ac436 | 53 | return $ret |
bc5065a7 | 54 | } |