* mi-support.exp (mi_gdb_start): Skip mi tests if -i flag is
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-basics.exp
CommitLineData
fb40c209
AC
1# Copyright (C) 1999 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# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20#
21# test basic Machine interface (MI) operations
22#
23# Verify that, using the MI, we can load a program and do
24# other basic things that are used by all test files through mi_gdb_exit,
25# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and
26# mi_gdb_load, so we can safely use those.
27#
28# The goal is not to test gdb functionality, which is done by other tests,
29# but the command syntax and correct output response to MI operations.
30#
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 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44}
45
46# In this file we want to test if the operations needed by the following
47# procedures work, so it makes no sense using them here.
48
49# mi_delete_breakpoints
50# mi_gdb_reinitialize_dir $srcdir/$subdir
51# mi_gdb_load ${binfile}
52
53# Test if the MI interpreter has been configured
54
55proc test_mi_interpreter_selection {} {
56 global mi_gdb_prompt
57 global gdb_prompt
58
59 # All this test expects is to get the prompt back
60 # with no syntax error message
61 send_gdb "-gdb-version\n"
62 gdb_expect {
63 -re "GNU gdb .*\r\n$mi_gdb_prompt$" \
64 { pass "acceptance of MI operations"
65 return 1}
66 -re ".*\r\n$mi_gdb_prompt$" \
67 { fail "acceptance of MI operations"
68 note "Skipping all other MI tests." }
69 -re "Undefined command.*$gdb_prompt $" \
70 { fail "acceptance of MI operations"
71 note "Skipping all other MI tests." }
72 -re ".*$gdb_prompt $" \
73 { fail "acceptance of MI operations"
74 note "Skipping all other MI tests." }
75 timeout { fail "acceptance of MI operations (timeout)"
76 note "Skipping all other MI tests." }
77 }
78 return 0
79}
80
81proc test_exec_and_symbol_mi_operatons {} {
82 global mi_gdb_prompt
83 global binfile
84
85 # Load symbols and specify executable on a single operation
86 # Tests:
87 # -file-exec-and-symbols
88
89 # Can't use mi_gdb_test as if this doesn't work,
90 # we must give up on the whole test file
91 send_gdb "-file-exec-and-symbols ${binfile}\n"
92 gdb_expect {
93 -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \
94 { pass "file-exec-and-symbols operation" }
95 timeout { fail "file-exec-and-symbols operation (timeout)"
96 note "Skipping all other MI tests."
97 return 0}
98 }
99
100 # The following is not used by mi-support.exp, but we test here so
101 # we get done with loading a program basics.
102
103 # Do it again, but now load symbols and specify executable with
104 # two separate operations
105 # Tests:
106 # -file-clear
107 # -file-exec-file
108 # -file-symbol-file
109
110 # FIXME: file-clear is not implemented yet.
2231a1e8
EZ
111# mi_gdb_test "-file-clear" \
112# "\\\^done" \
113# "file-clear operation"
fb40c209
AC
114
115 mi_gdb_test "-file-exec-file ${binfile}" \
116 "\\\^done" \
117 "file-exec-file operation"
118
119 mi_gdb_test "-file-symbol-file ${binfile}" \
120 "\\\^done" \
121 "file-symbol-file operation"
122
123 # FIXME: if we cannot load we have to skip all other tests.
124}
125
126proc test_breakpoints_deletion {} {
127 global mi_gdb_prompt
128 global srcfile
129
130 # Clear all breakpoints and list to confirm
131 # Tests:
132 # -break-delete (all)
133 # -break-list
134
135 # The all parameter is actually no parameter.
136 mi_gdb_test "200-break-delete" \
137 "\\\^done" \
138 "break-delete (all) operation"
139
140 mi_gdb_test "201-break-list" \
141 ".*\\\^done,BreakpointTable=\\\{\\\}" \
142 "all breakpoints removed"
143}
144
145proc test_dir_specification {} {
146 global mi_gdb_prompt
147 global srcdir
148 global subdir
149
150 # Clear the search directories, then specify one to be searched
151 # Tests:
152 # -environment-directory
153 # -environment-directory arg
154
155#exp_internal 1
156 mi_gdb_test "202-environment-directory" \
157 "\\\^done" \
158 "environment-directory operation"
159
160 mi_gdb_test "203-environment-directory ${srcdir}/${subdir}" \
161 "\\\^done" \
162 "environment-directory arg operation"
163#exp_internal 0
164}
165
166if [test_mi_interpreter_selection] {
167 test_exec_and_symbol_mi_operatons
168 test_breakpoints_deletion
169 test_dir_specification
170}
171
172mi_gdb_exit
173return 0
174
175# Local variables:
176# change-log-default-name: "ChangeLog-mi"
177# End:
This page took 0.114501 seconds and 4 git commands to generate.