Commit 6aea4225 authored by hjk's avatar hjk
Browse files

Debugger: Make LLDB dumpers more robust



Take care of older versions without SBValue.GetCanonicalType()

Change-Id: I10c1330633e5568b7c94059d4286c93adfecb1a2
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 8312ce27
...@@ -303,12 +303,13 @@ lldb.SBValue.cast = lambda self, typeObj: self.Cast(typeObj) ...@@ -303,12 +303,13 @@ lldb.SBValue.cast = lambda self, typeObj: self.Cast(typeObj)
lldb.SBValue.dereference = lambda self: self.Dereference() lldb.SBValue.dereference = lambda self: self.Dereference()
lldb.SBValue.address = property(lambda self: self.GetAddress()) lldb.SBValue.address = property(lambda self: self.GetAddress())
lldb.SBType.unqualified = lambda self: self.GetUnqualifiedType()
lldb.SBType.pointer = lambda self: self.GetPointerType() lldb.SBType.pointer = lambda self: self.GetPointerType()
lldb.SBType.code = lambda self: self.GetTypeClass() lldb.SBType.code = lambda self: self.GetTypeClass()
lldb.SBType.sizeof = property(lambda self: self.GetByteSize()) lldb.SBType.sizeof = property(lambda self: self.GetByteSize())
lldb.SBType.unqualified = \
lambda self: self.GetUnqualifiedType() if hasattr(self, 'GetUnqualifiedType') else self
lldb.SBType.strip_typedefs = \ lldb.SBType.strip_typedefs = \
lambda self: self.GetCanonicalType() if hasattr(self, 'GetCanonicalType') else self lambda self: self.GetCanonicalType() if hasattr(self, 'GetCanonicalType') else self
...@@ -1026,10 +1027,13 @@ class Dumper: ...@@ -1026,10 +1027,13 @@ class Dumper:
self.context = value self.context = value
qqDumpers[typeName](self, value) qqDumpers[typeName](self, value)
return return
value = value.Cast(value.GetType().GetCanonicalType().GetUnqualifiedType()) realType = value.GetType()
self.putItem(value) if hasattr(realType, 'GetCanonicalType'):
self.putBetterType(typeName) realType = realType.GetCanonicalType()
return value = value.Cast(realType.unqualified())
self.putItem(value)
self.putBetterType(typeName)
return
# Our turf now. # Our turf now.
value.SetPreferSyntheticValue(False) value.SetPreferSyntheticValue(False)
...@@ -1042,7 +1046,7 @@ class Dumper: ...@@ -1042,7 +1046,7 @@ class Dumper:
# References # References
if value.GetType().IsReferenceType(): if value.GetType().IsReferenceType():
origType = value.GetTypeName(); origType = value.GetTypeName();
type = value.GetType().GetDereferencedType().GetUnqualifiedType() type = value.GetType().GetDereferencedType().unqualified()
addr = int(value) & 0xFFFFFFFFFFFFFFFF addr = int(value) & 0xFFFFFFFFFFFFFFFF
self.putItem(value.CreateValueFromAddress(None, addr, type)) self.putItem(value.CreateValueFromAddress(None, addr, type))
#self.putItem(value.CreateValueFromData(None, value.GetData(), type)) #self.putItem(value.CreateValueFromData(None, value.GetData(), type))
...@@ -1058,7 +1062,7 @@ class Dumper: ...@@ -1058,7 +1062,7 @@ class Dumper:
return return
if self.autoDerefPointers: if self.autoDerefPointers:
innerType = value.GetType().GetPointeeType().GetUnqualifiedType() innerType = value.GetType().GetPointeeType().unqualified()
self.putType(innerType) self.putType(innerType)
savedCurrentChildType = self.currentChildType savedCurrentChildType = self.currentChildType
self.currentChildType = str(innerType) self.currentChildType = str(innerType)
...@@ -1144,8 +1148,9 @@ class Dumper: ...@@ -1144,8 +1148,9 @@ class Dumper:
self.putItem(child) self.putItem(child)
for i in xrange(m, n): for i in xrange(m, n):
child = value.GetChildAtIndex(i) child = value.GetChildAtIndex(i)
with SubItem(self, child): if child.IsValid(): # FIXME: Anon members?
self.putItem(child) with SubItem(self, child):
self.putItem(child)
def reportVariables(self, _ = None): def reportVariables(self, _ = None):
frame = self.currentThread().GetSelectedFrame() frame = self.currentThread().GetSelectedFrame()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment