lldb type synthetic python function execute failed when variable is shown in Watches View

I've write a lldb type synthetic for a complex struct,

it will use CreateValueFromExpression to create some child value and it works fine to transform the variable shown in Variables View,

but when I add the same variable to Watches View, it won't show the expected result and poduce an error:

 

the python snippet is:

 

if self.tag == JS_TAG_MAP["JS_TAG_FLOAT64"]:
fv = self.valobj.GetChildMemberWithName("u").GetChildMemberWithName("float64").GetData().GetDouble(e, 0)
self.propList.append({"name": "float", "value": self.valobj.CreateValueFromExpression("float", str(fv))})
desc = str(fv)
elif self.tag == JS_TAG_MAP["JS_TAG_INT"]:
fv = self.valobj.GetChildMemberWithName("u").GetChildMemberWithName("int32").GetValueAsSigned()
self.propList.append({"name": "int", "value": self.valobj.CreateValueFromExpression("int", str(fv))})
desc = str(fv)
elif self.tag == JS_TAG_MAP["JS_TAG_STRING"]:
svexp = self.valobj.CreateValueFromExpression("str", 'JS_ToCStringLen2(0,0,' + self.valobj.name + ',0)')
self.propList.append({"name": "str", "value": svexp})
desc = valobj.frame.GetThread().GetProcess().ReadCStringFromMemory(svexp.GetValueAsUnsigned(), 0xffffff, e)

Please sign in to leave a comment.