2 Test lldb-mi -var-xxx commands.
5 from __future__ import print_function
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
16 mydir = TestBase.compute_mydir(__file__)
18 @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
19 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
20 def test_lldbmi_eval(self):
21 """Test that 'lldb-mi --interpreter' works for evaluating."""
23 self.spawnLldbMi(args=None)
26 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
29 # Run to program return
30 line = line_number('main.cpp', '// BP_return')
31 self.runCmd("-break-insert main.cpp:%d" % line)
32 self.expect("\^done,bkpt={number=\"1\"")
33 self.runCmd("-exec-run")
34 self.expect("\^running")
35 self.expect("\*stopped,reason=\"breakpoint-hit\"")
37 # Print non-existant variable
38 self.runCmd("-var-create var1 * undef")
40 "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
41 self.runCmd("-data-evaluate-expression undef")
43 "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
45 # Print global "g_MyVar", modify, delete and create again
46 self.runCmd("-data-evaluate-expression g_MyVar")
47 self.expect("\^done,value=\"3\"")
48 self.runCmd("-var-create var2 * g_MyVar")
50 "\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
51 self.runCmd("-var-evaluate-expression var2")
52 self.expect("\^done,value=\"3\"")
53 self.runCmd("-var-show-attributes var2")
54 self.expect("\^done,status=\"editable\"")
55 self.runCmd("-var-list-children var2")
56 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
57 # Ensure -var-list-children also works with quotes
58 self.runCmd("-var-list-children \"var2\"")
59 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
60 self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
61 self.expect("\^done,value=\"30\"")
62 self.runCmd("-var-update --all-values var2")
63 # self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
64 # FIXME -var-update doesn't work
65 self.runCmd("-var-delete var2")
67 self.runCmd("-var-create var2 * g_MyVar")
69 "\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
71 # Print static "s_MyVar", modify, delete and create again
72 self.runCmd("-data-evaluate-expression s_MyVar")
73 self.expect("\^done,value=\"30\"")
74 self.runCmd("-var-create var3 * s_MyVar")
76 "\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
77 self.runCmd("-var-evaluate-expression var3")
78 self.expect("\^done,value=\"30\"")
79 self.runCmd("-var-show-attributes var3")
80 self.expect("\^done,status=\"editable\"")
81 self.runCmd("-var-list-children var3")
82 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
83 self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
84 self.expect("\^done,value=\"3\"")
85 self.runCmd("-var-update --all-values var3")
86 # self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
87 # FIXME -var-update doesn't work
88 self.runCmd("-var-delete var3")
90 self.runCmd("-var-create var3 * s_MyVar")
92 "\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
94 # Print local "b", modify, delete and create again
95 self.runCmd("-data-evaluate-expression b")
96 self.expect("\^done,value=\"20\"")
97 self.runCmd("-var-create var4 * b")
99 "\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
100 self.runCmd("-var-evaluate-expression var4")
101 self.expect("\^done,value=\"20\"")
102 self.runCmd("-var-show-attributes var4")
103 self.expect("\^done,status=\"editable\"")
104 self.runCmd("-var-list-children var4")
105 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
106 self.runCmd("-data-evaluate-expression \"b=2\"")
107 self.expect("\^done,value=\"2\"")
108 self.runCmd("-var-update --all-values var4")
109 # self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
110 # FIXME -var-update doesn't work
111 self.runCmd("-var-delete var4")
112 self.expect("\^done")
113 self.runCmd("-var-create var4 * b")
115 "\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
118 self.runCmd("-data-evaluate-expression \"a + b\"")
119 self.expect("\^done,value=\"12\"")
120 self.runCmd("-var-create var5 * \"a + b\"")
122 "\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
123 self.runCmd("-var-evaluate-expression var5")
124 self.expect("\^done,value=\"12\"")
125 self.runCmd("-var-show-attributes var5")
126 self.expect("\^done,status=\"editable\"") # FIXME editable or not?
127 self.runCmd("-var-list-children var5")
128 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
130 # Print argument "argv[0]"
131 self.runCmd("-data-evaluate-expression \"argv[0]\"")
133 "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" %
135 self.runCmd("-var-create var6 * \"argv[0]\"")
137 "\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" %
139 self.runCmd("-var-evaluate-expression var6")
141 "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" %
143 self.runCmd("-var-show-attributes var6")
144 self.expect("\^done,status=\"editable\"")
145 self.runCmd("-var-list-children --all-values var6")
146 # FIXME: The name below is not correct. It should be "var.*argv[0]".
147 # FIXME -var-list-children shows invalid thread-id
149 "\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"")
151 # Print an expression with spaces and optional arguments
152 self.runCmd("-data-evaluate-expression \"a + b\"")
153 self.expect("\^done,value=\"12\"")
154 self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0")
156 "\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
158 @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
159 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
160 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
161 def test_lldbmi_var_update(self):
162 """Test that 'lldb-mi --interpreter' works for -var-update."""
164 self.spawnLldbMi(args=None)
167 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
168 self.expect("\^done")
170 # Run to BP_var_update_test_init
171 line = line_number('main.cpp', '// BP_var_update_test_init')
172 self.runCmd("-break-insert main.cpp:%d" % line)
173 self.expect("\^done,bkpt={number=\"1\"")
174 self.runCmd("-exec-run")
175 self.expect("\^running")
176 self.expect("\*stopped,reason=\"breakpoint-hit\"")
179 self.runCmd("-var-create var_l * l")
181 "\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"")
182 self.runCmd("-var-create var_complx * complx")
184 "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
185 self.runCmd("-var-create var_complx_array * complx_array")
187 "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
189 # Go to BP_var_update_test_l
190 line = line_number('main.cpp', '// BP_var_update_test_l')
191 self.runCmd("-break-insert main.cpp:%d" % line)
192 self.expect("\^done,bkpt={number=\"2\"")
193 self.runCmd("-exec-continue")
194 self.expect("\^running")
195 self.expect("\*stopped,reason=\"breakpoint-hit\"")
197 # Test that var_l was updated
198 self.runCmd("-var-update --all-values var_l")
200 "\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
202 # Go to BP_var_update_test_complx
203 line = line_number('main.cpp', '// BP_var_update_test_complx')
204 self.runCmd("-break-insert main.cpp:%d" % line)
205 self.expect("\^done,bkpt={number=\"3\"")
206 self.runCmd("-exec-continue")
207 self.expect("\^running")
208 self.expect("\*stopped,reason=\"breakpoint-hit\"")
210 # Test that var_complx was updated
211 self.runCmd("-var-update --all-values var_complx")
213 "\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
215 # Go to BP_var_update_test_complx_array
216 line = line_number('main.cpp', '// BP_var_update_test_complx_array')
217 self.runCmd("-break-insert main.cpp:%d" % line)
218 self.expect("\^done,bkpt={number=\"4\"")
219 self.runCmd("-exec-continue")
220 self.expect("\^running")
221 self.expect("\*stopped,reason=\"breakpoint-hit\"")
223 # Test that var_complex_array was updated
224 self.runCmd("-var-update --all-values var_complx_array")
226 "\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
228 @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
229 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
230 def test_lldbmi_var_create_register(self):
231 """Test that 'lldb-mi --interpreter' works for -var-create $regname."""
233 self.spawnLldbMi(args=None)
236 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
237 self.expect("\^done")
240 self.runCmd("-break-insert -f main")
241 self.expect("\^done,bkpt={number=\"1\"")
242 self.runCmd("-exec-run")
243 self.expect("\^running")
244 self.expect("\*stopped,reason=\"breakpoint-hit\"")
246 # Find name of register 0
247 self.runCmd("-data-list-register-names 0")
248 self.expect("\^done,register-names=\[\".+?\"\]")
249 register_name = self.child.after.split("\"")[1]
251 # Create variable for register 0
252 # Note that message is different in Darwin and Linux:
253 # Darwin: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned long\",thread-id=\"1\",has_more=\"0\"
255 # "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned
256 # int\",thread-id=\"1\",has_more=\"0\"
257 self.runCmd("-var-create var_reg * $%s" % register_name)
259 "\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"")
261 # Assign value to variable
262 self.runCmd("-var-assign var_reg \"6\"")
263 # FIXME: the output has different format for 32bit and 64bit values
264 self.expect("\^done,value=\"0x0*?6\"")
266 # Assert register 0 updated
267 self.runCmd("-data-list-register-values d 0")
268 self.expect("\^done,register-values=\[{number=\"0\",value=\"6\"")
270 @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
271 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
272 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
273 def test_lldbmi_var_list_children(self):
274 """Test that 'lldb-mi --interpreter' works for -var-list-children."""
276 self.spawnLldbMi(args=None)
279 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
280 self.expect("\^done")
282 # Run to BP_var_list_children_test
283 line = line_number('main.cpp', '// BP_var_list_children_test')
284 self.runCmd("-break-insert main.cpp:%d" % line)
285 self.expect("\^done,bkpt={number=\"1\"")
286 self.runCmd("-exec-run")
287 self.expect("\^running")
288 self.expect("\*stopped,reason=\"breakpoint-hit\"")
291 self.runCmd("-var-create var_complx * complx")
293 "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
294 self.runCmd("-var-create var_complx_array * complx_array")
296 "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
297 self.runCmd("-var-create var_pcomplx * pcomplx")
299 "\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
301 # Test that -var-evaluate-expression can evaluate the children of
303 self.runCmd("-var-list-children var_complx")
304 self.runCmd("-var-evaluate-expression var_complx.i")
305 self.expect("\^done,value=\"3\"")
306 self.runCmd("-var-list-children var_complx_array")
307 self.runCmd("-var-evaluate-expression var_complx_array.[0]")
308 self.expect("\^done,value=\"\{...\}\"")
309 self.runCmd("-var-list-children var_pcomplx")
310 self.runCmd("-var-evaluate-expression var_pcomplx.complex_type")
311 self.expect("\^done,value=\"\{...\}\"")
313 # Test that -var-list-children lists empty children if range is empty
314 # (and that print-values is optional)
315 self.runCmd("-var-list-children var_complx 0 0")
316 self.expect("\^done,numchild=\"0\",has_more=\"1\"")
317 self.runCmd("-var-list-children var_complx 99 0")
318 self.expect("\^done,numchild=\"0\",has_more=\"1\"")
319 self.runCmd("-var-list-children var_complx 99 3")
320 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
322 # Test that -var-list-children lists all children with their values
323 # (and that from and to are optional)
324 self.runCmd("-var-list-children --all-values var_complx")
326 "\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
327 self.runCmd("-var-list-children --simple-values var_complx_array")
329 "\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
330 self.runCmd("-var-list-children 0 var_pcomplx")
332 "\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
334 # Test that -var-list-children lists children without values
335 self.runCmd("-var-list-children 0 var_complx 0 1")
337 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
338 self.runCmd("-var-list-children --no-values var_complx 0 1")
340 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
341 self.runCmd("-var-list-children --no-values var_complx_array 0 1")
343 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
344 self.runCmd("-var-list-children --no-values var_pcomplx 0 1")
346 "\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
348 # Test that -var-list-children lists children with all values
349 self.runCmd("-var-list-children 1 var_complx 1 2")
351 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
352 self.runCmd("-var-list-children --all-values var_complx 1 2")
354 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
355 self.runCmd("-var-list-children --all-values var_complx_array 1 2")
357 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
358 self.runCmd("-var-list-children --all-values var_pcomplx 1 2")
360 "\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
362 # Test that -var-list-children lists children with simple values
363 self.runCmd("-var-list-children 2 var_complx 2 4")
365 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
366 self.runCmd("-var-list-children --simple-values var_complx 2 4")
368 "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
369 self.runCmd("-var-list-children --simple-values var_complx_array 2 4")
370 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
371 self.runCmd("-var-list-children --simple-values var_pcomplx 2 4")
372 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
374 # Test that an invalid from is handled
375 # FIXME: -1 is treated as unsigned int
376 self.runCmd("-var-list-children 0 var_complx -1 0")
377 #self.expect("\^error,msg=\"Command 'var-list-children'\. Variable children range invalid\"")
379 # Test that an invalid to is handled
380 # FIXME: -1 is treated as unsigned int
381 self.runCmd("-var-list-children 0 var_complx 0 -1")
382 #self.expect("\^error,msg=\"Command 'var-list-children'\. Variable children range invalid\"")
384 # Test that a missing low-frame or high-frame is handled
385 self.runCmd("-var-list-children 0 var_complx 0")
387 "\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"")
389 @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
390 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
391 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
392 def test_lldbmi_var_create_for_stl_types(self):
393 """Test that 'lldb-mi --interpreter' print summary for STL types."""
395 self.spawnLldbMi(args=None)
398 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
399 self.expect("\^done")
401 # Run to BP_gdb_set_show_print_char_array_as_string_test
402 line = line_number('main.cpp', '// BP_cpp_stl_types_test')
403 self.runCmd("-break-insert main.cpp:%d" % line)
404 self.expect("\^done,bkpt={number=\"1\"")
405 self.runCmd("-exec-run")
406 self.expect("\^running")
407 self.expect("\*stopped,reason=\"breakpoint-hit\"")
409 # Test for std::string
410 self.runCmd("-var-create - * std_string")
412 '\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"')
414 @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
415 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
416 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
417 def test_lldbmi_var_create_for_unnamed_objects(self):
418 """Test that 'lldb-mi --interpreter' can expand unnamed structures and unions."""
420 self.spawnLldbMi(args=None)
423 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
424 self.expect("\^done")
427 line = line_number('main.cpp', '// BP_unnamed_objects_test')
428 self.runCmd("-break-insert main.cpp:%d" % line)
429 self.expect("\^done,bkpt={number=\"1\"")
430 self.runCmd("-exec-run")
431 self.expect("\^running")
432 self.expect("\*stopped,reason=\"breakpoint-hit\"")
434 # Evaluate struct_with_unions type and its children
435 self.runCmd("-var-create v0 * swu")
437 '\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"')
439 self.runCmd("-var-list-children v0")
441 # inspect the first unnamed union
442 self.runCmd("-var-list-children v0.$0")
443 self.runCmd("-var-evaluate-expression v0.$0.u_i")
444 self.expect('\^done,value="1"')
446 # inspect the second unnamed union
447 self.runCmd("-var-list-children v0.$1")
448 self.runCmd("-var-evaluate-expression v0.$1.u1")
449 self.expect('\^done,value="-1"')
450 # inspect unnamed structure
451 self.runCmd("-var-list-children v0.$1.$1")
452 self.runCmd("-var-evaluate-expression v0.$1.$1.s1")
453 self.expect('\^done,value="-1"')