1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import unittest2
class TestSwiftEmbeddedFrameVariable(TestBase):
@skipUnlessDarwin
@swiftTest
def test(self):
self.build()
self.implementation()
@skipUnlessDarwin
@swiftTest
def test_without_ast(self):
"""Run the test turning off instantion of Swift AST contexts in order to ensure that all type information comes from DWARF"""
self.build()
self.runCmd("setting set symbols.swift-enable-ast-context false")
self.implementation()
def implementation(self):
self.runCmd("setting set symbols.swift-enable-full-dwarf-debugging true")
target, process, thread, _ = lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.swift")
)
frame = thread.frames[0]
self.assertTrue(frame, "Frame 0 is valid.")
varB = frame.FindVariable("varB")
field = varB.GetChildMemberWithName("a").GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = varB.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
tuple = frame.FindVariable("tuple")
first = tuple.GetChildAtIndex(0)
field = first.GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
second = tuple.GetChildAtIndex(1)
a = second.GetChildMemberWithName("a")
field = a.GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = second.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
nonPayload1 = frame.FindVariable("nonPayload1")
lldbutil.check_variable(self, nonPayload1, False, value="one")
nonPayload2 = frame.FindVariable("nonPayload2")
lldbutil.check_variable(self, nonPayload2, False, value="two")
singlePayload = frame.FindVariable("singlePayload")
payload = singlePayload.GetChildMemberWithName("payload")
field = payload.GetChildMemberWithName("a").GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = payload.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
emptySinglePayload = frame.FindVariable("emptySinglePayload")
lldbutil.check_variable(self, emptySinglePayload, False, value="nonPayloadTwo")
smallMultipayloadEnum1 = frame.FindVariable("smallMultipayloadEnum1")
one = smallMultipayloadEnum1.GetChildMemberWithName("one")
lldbutil.check_variable(self, one, False, value="two")
smallMultipayloadEnum2 = frame.FindVariable("smallMultipayloadEnum2")
two = smallMultipayloadEnum2.GetChildMemberWithName("two")
lldbutil.check_variable(self, two, False, value="one")
bigMultipayloadEnum1 = frame.FindVariable("bigMultipayloadEnum1")
one = bigMultipayloadEnum1.GetChildMemberWithName("one")
first = one.GetChildAtIndex(0).GetChildMemberWithName("supField")
second = one.GetChildAtIndex(1).GetChildMemberWithName("supField")
third = one.GetChildAtIndex(2).GetChildMemberWithName("supField")
lldbutil.check_variable(self, first, False, value="42")
lldbutil.check_variable(self, second, False, value="43")
lldbutil.check_variable(self, third, False, value="44")
fullMultipayloadEnum1 = frame.FindVariable("fullMultipayloadEnum1")
one = fullMultipayloadEnum1.GetChildMemberWithName("one")
lldbutil.check_variable(self, one, False, value="120")
fullMultipayloadEnum2 = frame.FindVariable("fullMultipayloadEnum2")
two = fullMultipayloadEnum2.GetChildMemberWithName("two")
lldbutil.check_variable(self, two, False, value="9.5")
bigFullMultipayloadEnum1 = frame.FindVariable("bigFullMultipayloadEnum1")
one = bigFullMultipayloadEnum1.GetChildMemberWithName("one")
first = one.GetChildAtIndex(0)
second = one.GetChildAtIndex(1)
lldbutil.check_variable(self, first, False, value="209")
lldbutil.check_variable(self, second, False, value="315")
bigFullMultipayloadEnum2 = frame.FindVariable("bigFullMultipayloadEnum2")
two = bigFullMultipayloadEnum2.GetChildMemberWithName("two")
first = two.GetChildAtIndex(0)
second = two.GetChildAtIndex(1)
lldbutil.check_variable(self, first, False, value="452.5")
lldbutil.check_variable(self, second, False, value="753.5")
sup = frame.FindVariable("sup")
supField = sup.GetChildMemberWithName("supField")
lldbutil.check_variable(self, supField, False, value="42")
sub = frame.FindVariable("sub")
supField = sub.GetChildMemberWithName("supField")
lldbutil.check_variable(self, supField, False, value="42")
subField = sub.GetChildMemberWithName("subField")
a = subField.GetChildMemberWithName("a")
field = a.GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = subField.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
subSub = frame.FindVariable("subSub")
supField = subSub.GetChildMemberWithName("supField")
lldbutil.check_variable(self, supField, False, value="42")
subField = subSub.GetChildMemberWithName("subField")
a = subField.GetChildMemberWithName("a")
field = a.GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = subField.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
subSubField = subSub.GetChildMemberWithName(
"subSubField"
).GetChildMemberWithName("field")
lldbutil.check_variable(self, subSubField, False, value="4.5")
gsp = frame.FindVariable("gsp")
t = gsp.GetChildMemberWithName("t")
lldbutil.check_variable(self, t, False, value="42")
u = gsp.GetChildMemberWithName("u")
lldbutil.check_variable(self, u, False, value="94.5")
gsp2 = frame.FindVariable("gsp2")
t = gsp2.GetChildMemberWithName("t")
supField = t.GetChildMemberWithName("supField")
lldbutil.check_variable(self, supField, False, value="42")
u = gsp2.GetChildMemberWithName("u")
a = u.GetChildMemberWithName("a")
field = a.GetChildMemberWithName("field")
lldbutil.check_variable(self, field, False, value="4.5")
b = u.GetChildMemberWithName("b")
lldbutil.check_variable(self, b, False, value="123456")
gsp3 = frame.FindVariable("gsp3")
t = gsp3.GetChildMemberWithName("t")
one = t.GetChildMemberWithName("one")
first = one.GetChildAtIndex(0)
second = one.GetChildAtIndex(1)
lldbutil.check_variable(self, first, False, value="209")
lldbutil.check_variable(self, second, False, value="315")
u = gsp3.GetChildMemberWithName("u")
two = u.GetChildMemberWithName("two")
lldbutil.check_variable(self, two, False, value="one")
gcp = frame.FindVariable("gcp")
t = gcp.GetChildMemberWithName("t")
lldbutil.check_variable(self, t, False, value="55.5")
u = gcp.GetChildMemberWithName("u")
lldbutil.check_variable(self, u, False, value="9348")
either = frame.FindVariable("either")
left = either.GetChildMemberWithName("left")
lldbutil.check_variable(self, left, False, value="1234")
either2 = frame.FindVariable("either2")
right = either2.GetChildMemberWithName("right")
t = right.GetChildMemberWithName("t")
one = t.GetChildMemberWithName("one")
first = one.GetChildAtIndex(0)
second = one.GetChildAtIndex(1)
lldbutil.check_variable(self, first, False, value="209")
lldbutil.check_variable(self, second, False, value="315")
u = right.GetChildMemberWithName("u")
two = u.GetChildMemberWithName("two")
lldbutil.check_variable(self, two, False, value='one')
inner = frame.FindVariable("inner")
value = inner.GetChildMemberWithName("value")
lldbutil.check_variable(self, value, False, value='99')
innerer = frame.FindVariable("innerer")
innererValue = innerer.GetChildMemberWithName("innererValue")
lldbutil.check_variable(self, innererValue, False, value='101')
privateType = frame.FindVariable("privateType")
privateField = privateType.GetChildMemberWithName("privateField")
lldbutil.check_variable(self, privateField, False, value='100')
specializedInner = frame.FindVariable("specializedInner")
t = specializedInner.GetChildMemberWithName("t")
lldbutil.check_variable(self, t, False, value='837')
genericInner = frame.FindVariable("genericInner")
t = genericInner.GetChildMemberWithName("t")
lldbutil.check_variable(self, t, False, value='647')
u = genericInner.GetChildMemberWithName("u")
lldbutil.check_variable(self, u, False, value='674.5')
functionType = frame.FindVariable("functionType")
funcField = functionType.GetChildMemberWithName("funcField")
lldbutil.check_variable(self, funcField, False, value='67')
innerFunctionType = frame.FindVariable("innerFunctionType")
innerFuncField = innerFunctionType.GetChildMemberWithName("innerFuncField")
lldbutil.check_variable(self, innerFuncField, False, value='8479')
|