]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / tools / lldb-mi / variable / TestMiVar.py
1 """
2 Test lldb-mi -var-xxx commands.
3 """
4
5 from __future__ import print_function
6
7
8
9 import lldbmi_testcase
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14 class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
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."""
22
23         self.spawnLldbMi(args = None)
24
25         # Load executable
26         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
27         self.expect("\^done")
28
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\"")
36
37         # Print non-existant variable
38         self.runCmd("-var-create var1 * undef")
39         self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
40         self.runCmd("-data-evaluate-expression undef")
41         self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
42
43         # Print global "g_MyVar", modify, delete and create again
44         self.runCmd("-data-evaluate-expression g_MyVar")
45         self.expect("\^done,value=\"3\"")
46         self.runCmd("-var-create var2 * g_MyVar")
47         self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
48         self.runCmd("-var-evaluate-expression var2")
49         self.expect("\^done,value=\"3\"")
50         self.runCmd("-var-show-attributes var2")
51         self.expect("\^done,status=\"editable\"")
52         self.runCmd("-var-list-children var2")
53         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
54         # Ensure -var-list-children also works with quotes
55         self.runCmd("-var-list-children \"var2\"")
56         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
57         self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
58         self.expect("\^done,value=\"30\"")
59         self.runCmd("-var-update --all-values var2")
60         #self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
61         self.runCmd("-var-delete var2")
62         self.expect("\^done")
63         self.runCmd("-var-create var2 * g_MyVar")
64         self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
65
66         # Print static "s_MyVar", modify, delete and create again
67         self.runCmd("-data-evaluate-expression s_MyVar")
68         self.expect("\^done,value=\"30\"")
69         self.runCmd("-var-create var3 * s_MyVar")
70         self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
71         self.runCmd("-var-evaluate-expression var3")
72         self.expect("\^done,value=\"30\"")
73         self.runCmd("-var-show-attributes var3")
74         self.expect("\^done,status=\"editable\"")
75         self.runCmd("-var-list-children var3")
76         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
77         self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
78         self.expect("\^done,value=\"3\"")
79         self.runCmd("-var-update --all-values var3")
80         #self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
81         self.runCmd("-var-delete var3")
82         self.expect("\^done")
83         self.runCmd("-var-create var3 * s_MyVar")
84         self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
85
86         # Print local "b", modify, delete and create again
87         self.runCmd("-data-evaluate-expression b")
88         self.expect("\^done,value=\"20\"")
89         self.runCmd("-var-create var4 * b")
90         self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
91         self.runCmd("-var-evaluate-expression var4")
92         self.expect("\^done,value=\"20\"")
93         self.runCmd("-var-show-attributes var4")
94         self.expect("\^done,status=\"editable\"")
95         self.runCmd("-var-list-children var4")
96         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
97         self.runCmd("-data-evaluate-expression \"b=2\"")
98         self.expect("\^done,value=\"2\"")
99         self.runCmd("-var-update --all-values var4")
100         #self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
101         self.runCmd("-var-delete var4")
102         self.expect("\^done")
103         self.runCmd("-var-create var4 * b")
104         self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
105
106         # Print temp "a + b"
107         self.runCmd("-data-evaluate-expression \"a + b\"")
108         self.expect("\^done,value=\"12\"")
109         self.runCmd("-var-create var5 * \"a + b\"")
110         self.expect("\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
111         self.runCmd("-var-evaluate-expression var5")
112         self.expect("\^done,value=\"12\"")
113         self.runCmd("-var-show-attributes var5")
114         self.expect("\^done,status=\"editable\"") #FIXME editable or not?
115         self.runCmd("-var-list-children var5")
116         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
117
118         # Print argument "argv[0]"
119         self.runCmd("-data-evaluate-expression \"argv[0]\"")
120         self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
121         self.runCmd("-var-create var6 * \"argv[0]\"")
122         self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe)
123         self.runCmd("-var-evaluate-expression var6")
124         self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
125         self.runCmd("-var-show-attributes var6")
126         self.expect("\^done,status=\"editable\"")
127         self.runCmd("-var-list-children --all-values var6")
128         # FIXME: The name below is not correct. It should be "var.*argv[0]".
129         self.expect("\^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\"") #FIXME -var-list-children shows invalid thread-id
130
131     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
132     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
133     @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
134     def test_lldbmi_var_update(self):
135         """Test that 'lldb-mi --interpreter' works for -var-update."""
136
137         self.spawnLldbMi(args = None)
138
139         # Load executable
140         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
141         self.expect("\^done")
142
143         # Run to BP_var_update_test_init
144         line = line_number('main.cpp', '// BP_var_update_test_init')
145         self.runCmd("-break-insert main.cpp:%d" % line)
146         self.expect("\^done,bkpt={number=\"1\"")
147         self.runCmd("-exec-run")
148         self.expect("\^running")
149         self.expect("\*stopped,reason=\"breakpoint-hit\"")
150
151         # Setup variables
152         self.runCmd("-var-create var_l * l")
153         self.expect("\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"")
154         self.runCmd("-var-create var_complx * complx")
155         self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
156         self.runCmd("-var-create var_complx_array * complx_array")
157         self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
158
159         # Go to BP_var_update_test_l
160         line = line_number('main.cpp', '// BP_var_update_test_l')
161         self.runCmd("-break-insert main.cpp:%d" % line)
162         self.expect("\^done,bkpt={number=\"2\"")
163         self.runCmd("-exec-continue")
164         self.expect("\^running")
165         self.expect("\*stopped,reason=\"breakpoint-hit\"")
166
167         # Test that var_l was updated
168         self.runCmd("-var-update --all-values var_l")
169         self.expect("\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
170
171         # Go to BP_var_update_test_complx
172         line = line_number('main.cpp', '// BP_var_update_test_complx')
173         self.runCmd("-break-insert main.cpp:%d" % line)
174         self.expect("\^done,bkpt={number=\"3\"")
175         self.runCmd("-exec-continue")
176         self.expect("\^running")
177         self.expect("\*stopped,reason=\"breakpoint-hit\"")
178
179         # Test that var_complx was updated
180         self.runCmd("-var-update --all-values var_complx")
181         self.expect("\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
182
183         # Go to BP_var_update_test_complx_array
184         line = line_number('main.cpp', '// BP_var_update_test_complx_array')
185         self.runCmd("-break-insert main.cpp:%d" % line)
186         self.expect("\^done,bkpt={number=\"4\"")
187         self.runCmd("-exec-continue")
188         self.expect("\^running")
189         self.expect("\*stopped,reason=\"breakpoint-hit\"")
190
191         # Test that var_complex_array was updated
192         self.runCmd("-var-update --all-values var_complx_array")
193         self.expect("\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
194
195     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
196     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
197     def test_lldbmi_var_create_register(self):
198         """Test that 'lldb-mi --interpreter' works for -var-create $regname."""
199
200         self.spawnLldbMi(args = None)
201
202         # Load executable
203         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
204         self.expect("\^done")
205
206         # Run to main
207         self.runCmd("-break-insert -f main")
208         self.expect("\^done,bkpt={number=\"1\"")
209         self.runCmd("-exec-run")
210         self.expect("\^running")
211         self.expect("\*stopped,reason=\"breakpoint-hit\"")
212
213         # Find name of register 0
214         self.runCmd("-data-list-register-names 0")
215         self.expect("\^done,register-names=\[\".+?\"\]")
216         register_name = self.child.after.split("\"")[1]
217
218         # Create variable for register 0
219         # Note that message is different in Darwin and Linux:
220         # Darwin: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned long\",thread-id=\"1\",has_more=\"0\"
221         # Linux:  "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned int\",thread-id=\"1\",has_more=\"0\"
222         self.runCmd("-var-create var_reg * $%s" % register_name)
223         self.expect("\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"")
224
225         # Assign value to variable
226         self.runCmd("-var-assign var_reg \"6\"")
227         #FIXME: the output has different format for 32bit and 64bit values
228         self.expect("\^done,value=\"0x0*?6\"")
229
230         # Assert register 0 updated
231         self.runCmd("-data-list-register-values d 0")
232         self.expect("\^done,register-values=\[{number=\"0\",value=\"6\"")
233
234     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
235     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
236     @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
237     def test_lldbmi_var_list_children(self):
238         """Test that 'lldb-mi --interpreter' works for -var-list-children."""
239
240         self.spawnLldbMi(args = None)
241
242         # Load executable
243         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
244         self.expect("\^done")
245
246         # Run to BP_var_list_children_test
247         line = line_number('main.cpp', '// BP_var_list_children_test')
248         self.runCmd("-break-insert main.cpp:%d" % line)
249         self.expect("\^done,bkpt={number=\"1\"")
250         self.runCmd("-exec-run")
251         self.expect("\^running")
252         self.expect("\*stopped,reason=\"breakpoint-hit\"")
253
254         # Create variable
255         self.runCmd("-var-create var_complx * complx")
256         self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
257         self.runCmd("-var-create var_complx_array * complx_array")
258         self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
259         self.runCmd("-var-create var_pcomplx * pcomplx")
260         self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
261
262         # Test that -var-evaluate-expression can evaluate the children of created varobj
263         self.runCmd("-var-list-children var_complx")
264         self.runCmd("-var-evaluate-expression var_complx.i")
265         self.expect("\^done,value=\"3\"")
266         self.runCmd("-var-list-children var_complx_array")
267         self.runCmd("-var-evaluate-expression var_complx_array.[0]")
268         self.expect("\^done,value=\"\{...\}\"")
269         self.runCmd("-var-list-children var_pcomplx")
270         self.runCmd("-var-evaluate-expression var_pcomplx.complex_type")
271         self.expect("\^done,value=\"\{...\}\"")
272
273         # Test that -var-list-children lists empty children if range is empty
274         # (and that print-values is optional)
275         self.runCmd("-var-list-children var_complx 0 0")
276         self.expect("\^done,numchild=\"0\",has_more=\"1\"")
277         self.runCmd("-var-list-children var_complx 99 0")
278         self.expect("\^done,numchild=\"0\",has_more=\"1\"")
279         self.runCmd("-var-list-children var_complx 99 3")
280         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
281
282         # Test that -var-list-children lists all children with their values
283         # (and that from and to are optional)
284         self.runCmd("-var-list-children --all-values var_complx")
285         self.expect("\^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\"")
286         self.runCmd("-var-list-children --simple-values var_complx_array")
287         self.expect("\^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\"")
288         self.runCmd("-var-list-children 0 var_pcomplx")
289         self.expect("\^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\"")
290
291         # Test that -var-list-children lists children without values
292         self.runCmd("-var-list-children 0 var_complx 0 1")
293         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
294         self.runCmd("-var-list-children --no-values var_complx 0 1")
295         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
296         self.runCmd("-var-list-children --no-values var_complx_array 0 1")
297         self.expect("\^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\"")
298         self.runCmd("-var-list-children --no-values var_pcomplx 0 1")
299         self.expect("\^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\"")
300
301         # Test that -var-list-children lists children with all values
302         self.runCmd("-var-list-children 1 var_complx 1 2")
303         self.expect("\^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\"")
304         self.runCmd("-var-list-children --all-values var_complx 1 2")
305         self.expect("\^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\"")
306         self.runCmd("-var-list-children --all-values var_complx_array 1 2")
307         self.expect("\^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\"")
308         self.runCmd("-var-list-children --all-values var_pcomplx 1 2")
309         self.expect("\^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\"")
310
311         # Test that -var-list-children lists children with simple values
312         self.runCmd("-var-list-children 2 var_complx 2 4")
313         self.expect("\^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\"")
314         self.runCmd("-var-list-children --simple-values var_complx 2 4")
315         self.expect("\^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\"")
316         self.runCmd("-var-list-children --simple-values var_complx_array 2 4")
317         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
318         self.runCmd("-var-list-children --simple-values var_pcomplx 2 4")
319         self.expect("\^done,numchild=\"0\",has_more=\"0\"")
320
321         # Test that an invalid from is handled
322         # FIXME: -1 is treated as unsigned int
323         self.runCmd("-var-list-children 0 var_complx -1 0")
324         #self.expect("\^error,msg=\"Command 'var-list-children'\. Variable children range invalid\"")
325
326         # Test that an invalid to is handled
327         # FIXME: -1 is treated as unsigned int
328         self.runCmd("-var-list-children 0 var_complx 0 -1")
329         #self.expect("\^error,msg=\"Command 'var-list-children'\. Variable children range invalid\"")
330
331         # Test that a missing low-frame or high-frame is handled
332         self.runCmd("-var-list-children 0 var_complx 0")
333         self.expect("\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"")
334
335     @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
336     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
337     @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
338     def test_lldbmi_var_create_for_stl_types(self):
339         """Test that 'lldb-mi --interpreter' print summary for STL types."""
340
341         self.spawnLldbMi(args = None)
342
343         # Load executable
344         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
345         self.expect("\^done")
346
347         # Run to BP_gdb_set_show_print_char_array_as_string_test
348         line = line_number('main.cpp', '// BP_cpp_stl_types_test')
349         self.runCmd("-break-insert main.cpp:%d" % line)
350         self.expect("\^done,bkpt={number=\"1\"")
351         self.runCmd("-exec-run")
352         self.expect("\^running")
353         self.expect("\*stopped,reason=\"breakpoint-hit\"")
354
355         # Test for std::string
356         self.runCmd("-var-create - * std_string")
357         self.expect('\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"')
358  
359     @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
360     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
361     @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
362     def test_lldbmi_var_create_for_unnamed_objects(self):
363         """Test that 'lldb-mi --interpreter' can expand unnamed structures and unions."""
364
365         self.spawnLldbMi(args = None)
366
367         # Load executable
368         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
369         self.expect("\^done")
370
371         # Run to breakpoint
372         line = line_number('main.cpp', '// BP_unnamed_objects_test')
373         self.runCmd("-break-insert main.cpp:%d" % line)
374         self.expect("\^done,bkpt={number=\"1\"")
375         self.runCmd("-exec-run")
376         self.expect("\^running")
377         self.expect("\*stopped,reason=\"breakpoint-hit\"")
378
379         # Evaluate struct_with_unions type and its children
380         self.runCmd("-var-create v0 * swu")
381         self.expect('\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"')
382        
383         self.runCmd("-var-list-children v0")
384         
385         # inspect the first unnamed union
386         self.runCmd("-var-list-children v0.$0")
387         self.runCmd("-var-evaluate-expression v0.$0.u_i")
388         self.expect('\^done,value="1"')
389         
390         # inspect the second unnamed union
391         self.runCmd("-var-list-children v0.$1")
392         self.runCmd("-var-evaluate-expression v0.$1.u1")
393         self.expect('\^done,value="-1"')
394         # inspect unnamed structure
395         self.runCmd("-var-list-children v0.$1.$1")
396         self.runCmd("-var-evaluate-expression v0.$1.$1.s1")
397         self.expect('\^done,value="-1"')
398