]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-async.exp
* target.c (target_async_permitted, target_async_permitted_1)
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-async.exp
CommitLineData
fd0e64da
NR
1# Copyright 2008 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 2 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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17#
18# Test asynchronous Machine Interface (MI) responses.
19#
20
21# This currently only works with native linux and the async remote protocol.
22if { !([isnative] && [istarget *-linux*]) \
23 && (![target_info exists gdb_protocol] \
24 || [target_info gdb_protocol] != "async") } then {
25 return
26}
27
28# The plan is for async mode to become the default but toggle for now.
29set saved_gdbflags $GDBFLAGS
c6ebd6cf 30set GDBFLAGS [concat $GDBFLAGS " -ex \"set target-async on\""]
fd0e64da
NR
31
32load_lib mi-support.exp
33
34gdb_exit
35if [mi_gdb_start] {
36 continue
37}
38
39set testfile "basics"
40set srcfile ${testfile}.c
41set binfile ${objdir}/${subdir}/${testfile}
42if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
43 untested mi-async.exp
44 return -1
45}
46
47mi_delete_breakpoints
48mi_gdb_reinitialize_dir $srcdir/$subdir
49mi_gdb_load ${binfile}
50
51# mi_gdb_test cannot be used for asynchronous commands because there are
52# two prompts involved and this can lead to a race condition.
53
54proc linux_async_tests {} {
55 global mi_gdb_prompt
56 global hex
57
58 set line_main_head [gdb_get_line_number "main ("]
59 set line_main_body [expr $line_main_head + 2]
60 set line_main_next [expr $line_main_head + 3]
61
a2840c35
VP
62 mi_send_resuming_command_raw "start" "start: send"
63 mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop"
64
65 mi_send_resuming_command_raw "next" "CLI next: send"
66 mi_expect_stop "end-stepping-range" "main" "" ".*basics.c" "$line_main_next" "" "CLI next: stop"
fd0e64da
NR
67
68 mi_gdb_test "-exec-interrupt" \
69 "" \
70 ""
71
a2840c35
VP
72 mi_send_resuming_command_raw "start" "restart: send"
73 mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "restart: stop"
fd0e64da
NR
74}
75
76
77linux_async_tests
78
79mi_gdb_exit
80
81set GDBFLAGS $saved_gdbflags
82
83return 0