Update tests to include value field in output of -var-create.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-var-block.exp
1 # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2007
2 # Free Software Foundation, Inc.
3 #
4 # This Program Is Free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # Test essential Machine interface (MI) operations
19 #
20 # Verify that, using the MI, we can create, update, delete variables.
21 #
22
23
24 load_lib mi-support.exp
25 set MIFLAGS "-i=mi2"
26
27 gdb_exit
28 if [mi_gdb_start] {
29 continue
30 }
31
32 set testfile "var-cmd"
33 set srcfile ${testfile}.c
34 set binfile ${objdir}/${subdir}/${testfile}
35 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
36 untested mi2-var-block.exp
37 return -1
38 }
39
40 mi_delete_breakpoints
41 mi_gdb_reinitialize_dir $srcdir/$subdir
42 mi_gdb_load ${binfile}
43
44 mi_runto do_block_tests
45
46 # Test: c_variable-3.2
47 # Desc: create cb and foo
48 mi_create_varobj cb cb "create local variable cb"
49
50 mi_gdb_test "-var-create foo * foo" \
51 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
52 "create local variable foo"
53
54 # step to "foo = 123;"
55 mi_step_to "do_block_tests" "" "var-cmd.c" \
56 [gdb_get_line_number "foo = 123;"] \
57 "step at do_block_test"
58
59
60 # Be paranoid and assume 3.2 created foo
61 mi_gdb_test "-var-delete foo" \
62 "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
63 "delete var foo"
64
65
66 # Test: c_variable-3.3
67 # Desc: create foo
68 mi_create_varobj foo foo "create local variable foo"
69
70 # step to "foo2 = 123;"
71 mi_step_to "do_block_tests" "" "var-cmd.c" \
72 [gdb_get_line_number "foo2 = 123;"] \
73 "step at do_block_test"
74
75 # Test: c_variable-3.4
76 # Desc: check foo, cb changed
77 mi_gdb_test "-var-update *" \
78 "\\^done,changelist=\\\[\{name=\"foo\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
79 "update all vars: cb foo changed"
80
81 # step to "foo = 321;"
82 mi_step_to "do_block_tests" "" "var-cmd.c" \
83 [gdb_get_line_number "foo = 321;"] \
84 "step at do_block_test"
85
86 # Test: c_variable-3.5
87 # Desc: create inner block foo
88 mi_create_varobj inner_foo foo "create local variable inner_foo"
89
90 # step to "foo2 = 0;"
91 mi_step_to "do_block_tests" "" "var-cmd.c" \
92 [gdb_get_line_number "foo2 = 0;"] \
93 "step at do_block_test"
94
95 # Test: c_variable-3.6
96 # Desc: create foo2
97 mi_create_varobj foo2 foo2 "create local variable foo2"
98
99 # Test: c_variable-3.7
100 # Desc: check that outer foo in scope and inner foo out of scope
101 # Note: also a known gdb problem
102 setup_xfail *-*-*
103 mi_gdb_test "-var-update inner_foo" \
104 "\\^done,changelist=\{FIXME\}" \
105 "update inner_foo: should be out of scope: KNOWN PROBLEM"
106 clear_xfail *-*-*
107
108 setup_xfail *-*-*
109 mi_gdb_test "-var-evaluate-expression inner_foo" \
110 "\\^done,value=\{FIXME\}" \
111 "evaluate inner_foo: should be out of scope: KNOWN PROBLEM"
112 clear_xfail *-*-*
113
114 mi_gdb_test "-var-update foo" \
115 "\\^done,changelist=\\\[\\\]" \
116 "update foo: did not change"
117
118 mi_gdb_test "-var-delete inner_foo" \
119 "\\^done,ndeleted=\"1\"" \
120 "delete var inner_foo"
121
122 # step to "foo = 0;"
123 mi_step_to "do_block_tests" "" "var-cmd.c" \
124 [gdb_get_line_number "foo = 0;"] \
125 "step at do_block_test"
126
127 # Test: c_variable-3.8
128 # Desc: check that foo2 out of scope (known gdb problem)
129 setup_xfail *-*-*
130 mi_gdb_test "-var-update foo2" \
131 "\\^done,changelist=\{FIXME\}" \
132 "update foo2: should be out of scope: KNOWN PROBLEM"
133 clear_xfail *-*-*
134
135 # step to "cb = 21;"
136 mi_step_to "do_block_tests" "" "var-cmd.c" \
137 [gdb_get_line_number "cb = 21;"] \
138 "step at do_block_test"
139
140 # Test: c_variable-3.9
141 # Desc: check that only cb is in scope (known gdb problem)
142 setup_xfail *-*-*
143 mi_gdb_test "-var-update foo2" \
144 "\\^done,changelist=\\\[FIXME\\\]" \
145 "update foo2 should be out of scope: KNOWN PROBLEM"
146 clear_xfail *-*-*
147 setup_xfail *-*-*
148 mi_gdb_test "-var-update foo" \
149 "\\^done,changelist=\{FIXME\}" \
150 "update foo should be out of scope: KNOWN PROBLEM"
151 clear_xfail *-*-*
152 mi_gdb_test "-var-update cb" \
153 "\\^done,changelist=\\\[\\\]" \
154 "update cb"
155
156 # Test: c_variable-3.10
157 # Desc: names of editable variables
158 #gdbtk_test c_variable-3.10 {names of editable variables} {
159 # editable_variables
160 #} {{foo cb foo2} {}}
161
162 # Done with block tests
163 mi_gdb_test "-var-delete foo" \
164 "\\^done,ndeleted=\"1\"" \
165 "delete var foo"
166
167 mi_gdb_test "-var-delete foo2" \
168 "\\^done,ndeleted=\"1\"" \
169 "delete var foo2"
170
171 mi_gdb_test "-var-delete cb" \
172 "\\^done,ndeleted=\"1\"" \
173 "delete var cb"
174
175 mi_gdb_exit
176 return 0
This page took 0.043589 seconds and 5 git commands to generate.