]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-var-block.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-var-block.exp
CommitLineData
8acc9f48 1# Copyright 1999-2013 Free Software Foundation, Inc.
fb40c209 2#
e22f8b7c 3# This program is free software; you can redistribute it and/or modify
fb40c209 4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
fb40c209
AC
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
fb40c209 15
fb40c209
AC
16# Test essential Machine interface (MI) operations
17#
18# Verify that, using the MI, we can create, update, delete variables.
19#
20
21
22load_lib mi-support.exp
b30bf9ee 23set MIFLAGS "-i=mi"
fb40c209
AC
24
25gdb_exit
26if [mi_gdb_start] {
27 continue
28}
29
298a9cf0
TT
30standard_testfile var-cmd.c
31
9357e021 32if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
b60f0898
JB
33 untested mi-var-block.exp
34 return -1
fb40c209
AC
35}
36
37mi_delete_breakpoints
38mi_gdb_reinitialize_dir $srcdir/$subdir
39mi_gdb_load ${binfile}
40
6afa27b0 41mi_runto do_block_tests
fb40c209
AC
42
43# Test: c_variable-3.2
44# Desc: create cb and foo
9e8e3afe 45mi_create_varobj "cb" "cb" "create local variable cb"
fb40c209
AC
46
47mi_gdb_test "-var-create foo * foo" \
1b05df00 48 "\\^error,msg=\"-var-create: unable to create variable object\"" \
9e8e3afe 49 "try to create local variable foo"
fb40c209
AC
50
51# step to "foo = 123;"
469aff8e
MC
52mi_step_to "do_block_tests" "" "var-cmd.c" \
53 [gdb_get_line_number "foo = 123;"] \
54 "step at do_block_test"
fb40c209
AC
55
56
57# Be paranoid and assume 3.2 created foo
58mi_gdb_test "-var-delete foo" \
a13e061a 59 "\\^error,msg=\"Variable object not found\"" \
fb40c209
AC
60 "delete var foo"
61
62
63# Test: c_variable-3.3
64# Desc: create foo
9e8e3afe 65mi_create_varobj "foo" "foo" "create local variable foo"
fb40c209
AC
66
67# step to "foo2 = 123;"
469aff8e
MC
68mi_step_to "do_block_tests" "" "var-cmd.c" \
69 [gdb_get_line_number "foo2 = 123;"] \
70 "step at do_block_test"
fb40c209
AC
71
72# Test: c_variable-3.4
73# Desc: check foo, cb changed
74mi_gdb_test "-var-update *" \
0cc7d26f 75 "\\^done,changelist=\\\[\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"cb\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
fb40c209
AC
76 "update all vars: cb foo changed"
77
78# step to "foo = 321;"
469aff8e
MC
79mi_step_to "do_block_tests" "" "var-cmd.c" \
80 [gdb_get_line_number "foo = 321;"] \
81 "step at do_block_test"
fb40c209
AC
82
83# Test: c_variable-3.5
84# Desc: create inner block foo
9e8e3afe 85mi_create_varobj "inner_foo" "foo" "create local variable inner_foo"
fb40c209
AC
86
87# step to "foo2 = 0;"
469aff8e
MC
88mi_step_to "do_block_tests" "" "var-cmd.c" \
89 [gdb_get_line_number "foo2 = 0;"] \
90 "step at do_block_test"
fb40c209
AC
91
92# Test: c_variable-3.6
93# Desc: create foo2
9e8e3afe 94mi_create_varobj "foo2" "foo2" "create local variable foo2"
fb40c209
AC
95
96# Test: c_variable-3.7
97# Desc: check that outer foo in scope and inner foo out of scope
98# Note: also a known gdb problem
99setup_xfail *-*-*
100mi_gdb_test "-var-update inner_foo" \
101 "\\^done,changelist=\{FIXME\}" \
102 "update inner_foo: should be out of scope: KNOWN PROBLEM"
103clear_xfail *-*-*
104
105setup_xfail *-*-*
106mi_gdb_test "-var-evaluate-expression inner_foo" \
107 "\\^done,value=\{FIXME\}" \
108 "evaluate inner_foo: should be out of scope: KNOWN PROBLEM"
109clear_xfail *-*-*
110
111mi_gdb_test "-var-update foo" \
93cae4bf 112 "\\^done,changelist=\\\[\\\]" \
fb40c209
AC
113 "update foo: did not change"
114
115mi_gdb_test "-var-delete inner_foo" \
116 "\\^done,ndeleted=\"1\"" \
117 "delete var inner_foo"
118
119# step to "foo = 0;"
469aff8e
MC
120mi_step_to "do_block_tests" "" "var-cmd.c" \
121 [gdb_get_line_number "foo = 0;"] \
122 "step at do_block_test"
fb40c209
AC
123
124# Test: c_variable-3.8
125# Desc: check that foo2 out of scope (known gdb problem)
126setup_xfail *-*-*
127mi_gdb_test "-var-update foo2" \
128 "\\^done,changelist=\{FIXME\}" \
129 "update foo2: should be out of scope: KNOWN PROBLEM"
130clear_xfail *-*-*
131
132# step to "cb = 21;"
469aff8e
MC
133mi_step_to "do_block_tests" "" "var-cmd.c" \
134 [gdb_get_line_number "cb = 21;"] \
135 "step at do_block_test"
fb40c209
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" \
93cae4bf 141 "\\^done,changelist=\\\[FIXME\\\]" \
fb40c209
AC
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" \
93cae4bf 150 "\\^done,changelist=\\\[\\\]" \
fb40c209
AC
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