2002-11-04 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi1-var-block.exp
CommitLineData
6afa27b0 1# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
1f609b42
AC
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# Test essential Machine interface (MI) operations
21#
22# Verify that, using the MI, we can create, update, delete variables.
23#
24
25
26load_lib mi-support.exp
27set MIFLAGS "-i=mi1"
28
29gdb_exit
30if [mi_gdb_start] {
31 continue
32}
33
34set testfile "var-cmd"
35set srcfile ${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
38 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39}
40
41mi_delete_breakpoints
42mi_gdb_reinitialize_dir $srcdir/$subdir
43mi_gdb_load ${binfile}
44
6afa27b0 45mi_runto do_block_tests
1f609b42
AC
46
47# Test: c_variable-3.2
48# Desc: create cb and foo
49mi_gdb_test "-var-create cb * cb" \
50 "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \
51 "create local variable cb"
52
53mi_gdb_test "-var-create foo * foo" \
54 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
55 "create local variable foo"
56
57# step to "foo = 123;"
6afa27b0 58mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
1f609b42
AC
59
60
61# Be paranoid and assume 3.2 created foo
62mi_gdb_test "-var-delete foo" \
63 "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
64 "delete var foo"
65
66
67# Test: c_variable-3.3
68# Desc: create foo
69mi_gdb_test "-var-create foo * foo" \
70 "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \
71 "create local variable foo"
72
73# step to "foo2 = 123;"
6afa27b0 74mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
1f609b42
AC
75
76# Test: c_variable-3.4
77# Desc: check foo, cb changed
78mi_gdb_test "-var-update *" \
79 "\\^done,changelist=\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}" \
80 "update all vars: cb foo changed"
81
82# step to "foo = 321;"
6afa27b0 83mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test"
1f609b42
AC
84
85# Test: c_variable-3.5
86# Desc: create inner block foo
87mi_gdb_test "-var-create inner_foo * foo" \
88 "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \
89 "create local variable inner_foo"
90
91# step to "foo2 = 0;"
6afa27b0 92mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
1f609b42
AC
93
94# Test: c_variable-3.6
95# Desc: create foo2
96mi_gdb_test "-var-create foo2 * foo2" \
97 "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \
98 "create local variable foo2"
99
100# Test: c_variable-3.7
101# Desc: check that outer foo in scope and inner foo out of scope
102# Note: also a known gdb problem
103setup_xfail *-*-*
104mi_gdb_test "-var-update inner_foo" \
105 "\\^done,changelist=\{FIXME\}" \
106 "update inner_foo: should be out of scope: KNOWN PROBLEM"
107clear_xfail *-*-*
108
109setup_xfail *-*-*
110mi_gdb_test "-var-evaluate-expression inner_foo" \
111 "\\^done,value=\{FIXME\}" \
112 "evaluate inner_foo: should be out of scope: KNOWN PROBLEM"
113clear_xfail *-*-*
114
115mi_gdb_test "-var-update foo" \
116 "\\^done,changelist=\{\}" \
117 "update foo: did not change"
118
119mi_gdb_test "-var-delete inner_foo" \
120 "\\^done,ndeleted=\"1\"" \
121 "delete var inner_foo"
122
123# step to "foo = 0;"
6afa27b0 124mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
1f609b42
AC
125
126# Test: c_variable-3.8
127# Desc: check that foo2 out of scope (known gdb problem)
128setup_xfail *-*-*
129mi_gdb_test "-var-update foo2" \
130 "\\^done,changelist=\{FIXME\}" \
131 "update foo2: should be out of scope: KNOWN PROBLEM"
132clear_xfail *-*-*
133
134# step to "cb = 21;"
6afa27b0 135mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
1f609b42
AC
136
137# Test: c_variable-3.9
138# Desc: check that only cb is in scope (known gdb problem)
139setup_xfail *-*-*
140mi_gdb_test "-var-update foo2" \
141 "\\^done,changelist=\{FIXME\}" \
142 "update foo2 should be out of scope: KNOWN PROBLEM"
143clear_xfail *-*-*
144setup_xfail *-*-*
145mi_gdb_test "-var-update foo" \
146 "\\^done,changelist=\{FIXME\}" \
147 "update foo should be out of scope: KNOWN PROBLEM"
148clear_xfail *-*-*
149mi_gdb_test "-var-update cb" \
150 "\\^done,changelist=\{\}" \
151 "update cb"
152
153# Test: c_variable-3.10
154# Desc: names of editable variables
155#gdbtk_test c_variable-3.10 {names of editable variables} {
156# editable_variables
157#} {{foo cb foo2} {}}
158
159# Done with block tests
160mi_gdb_test "-var-delete foo" \
161 "\\^done,ndeleted=\"1\"" \
162 "delete var foo"
163
164mi_gdb_test "-var-delete foo2" \
165 "\\^done,ndeleted=\"1\"" \
166 "delete var foo2"
167
168mi_gdb_test "-var-delete cb" \
169 "\\^done,ndeleted=\"1\"" \
170 "delete var cb"
171
172mi_gdb_exit
173return 0
This page took 0.091853 seconds and 4 git commands to generate.