]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2008-2024 Free Software Foundation, Inc. |
fd0e64da NR |
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 | |
d53a7b30 | 5 | # the Free Software Foundation; either version 3 of the License, or |
fd0e64da | 6 | # (at your option) any later version. |
d53a7b30 | 7 | # |
fd0e64da NR |
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. | |
d53a7b30 | 12 | # |
fd0e64da | 13 | # You should have received a copy of the GNU General Public License |
d53a7b30 | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
fd0e64da NR |
15 | |
16 | # | |
17 | # Test asynchronous Machine Interface (MI) responses. | |
18 | # | |
19 | ||
fcae584b VP |
20 | # Because of the way this test is written, using 'start' and not using |
21 | # mi_run_cmd, it ignores whatever target the rest of GDB testsuite is | |
22 | # using, and always tries to run natively. So, don't do anything unless | |
23 | # we're actually testing native. | |
604f757b TT |
24 | require isnative |
25 | if {![istarget *-linux*]} { | |
fd0e64da NR |
26 | return |
27 | } | |
28 | ||
2786ef85 | 29 | # Check if start command is supported. |
793862d2 | 30 | require !use_gdb_stub |
2786ef85 | 31 | |
fd0e64da NR |
32 | load_lib mi-support.exp |
33 | ||
298a9cf0 TT |
34 | standard_testfile basics.c |
35 | ||
9357e021 | 36 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
5b362f04 | 37 | untested "failed to compile" |
fd0e64da NR |
38 | return -1 |
39 | } | |
40 | ||
9dd1e642 TV |
41 | # The plan is for async mode to become the default but toggle for now. |
42 | save_vars { GDBFLAGS } { | |
43 | set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""] | |
44 | ||
45 | if {[mi_clean_restart $binfile]} { | |
46 | return | |
47 | } | |
3ad2b4af | 48 | } |
fd0e64da NR |
49 | |
50 | # mi_gdb_test cannot be used for asynchronous commands because there are | |
51 | # two prompts involved and this can lead to a race condition. | |
52 | ||
53 | proc linux_async_tests {} { | |
54 | global mi_gdb_prompt | |
55 | global hex | |
56 | ||
57 | set line_main_head [gdb_get_line_number "main ("] | |
58 | set line_main_body [expr $line_main_head + 2] | |
59 | set line_main_next [expr $line_main_head + 3] | |
60 | ||
a2840c35 VP |
61 | mi_send_resuming_command_raw "start" "start: send" |
62 | mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop" | |
63 | ||
64 | mi_send_resuming_command_raw "next" "CLI next: send" | |
65 | mi_expect_stop "end-stepping-range" "main" "" ".*basics.c" "$line_main_next" "" "CLI next: stop" | |
fd0e64da NR |
66 | |
67 | mi_gdb_test "-exec-interrupt" \ | |
68 | "" \ | |
69 | "" | |
70 | ||
a2840c35 VP |
71 | mi_send_resuming_command_raw "start" "restart: send" |
72 | mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "restart: stop" | |
fd0e64da NR |
73 | } |
74 | ||
75 | ||
76 | linux_async_tests | |
77 | ||
78 | mi_gdb_exit |