Commit 3d4cedb1 authored by hjk's avatar hjk
Browse files

Debugger: Fix map dumper with LLDB-320.x



The underlying problem here is still that we can deduce
the item type from the map type except by string manipulation
and type lookup. Which fails at times.

Change-Id: Ibe6a8ca1fbd84c43c7d31b65e017792d1b6a1e0b
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent cfe29cc9
......@@ -286,7 +286,6 @@ class Dumper(DumperBase):
self.isShuttingDown_ = False
self.isInterrupting_ = False
self.dummyValue = None
self.types_ = {}
self.breakpointsToCheck = set([])
def enterSubItem(self, item):
......@@ -612,26 +611,39 @@ class Dumper(DumperBase):
def lookupType(self, name):
#self.warn("LOOKUP TYPE NAME: %s" % name)
if name.endswith('*'):
typeobj = self.lookupType(name[:-1].strip())
return typeobj.GetPointerType() if type.IsValid() else None
typeobj = self.target.FindFirstType(name)
#self.warn("LOOKUP RESULT: %s" % typeobj.name)
#self.warn("LOOKUP VALID: %s" % typeobj.IsValid())
if typeobj.IsValid():
return typeobj
try:
if len(self.types_) == 0:
for i in xrange(self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(i)
# SBModule.GetType is new somewhere after early 300.x
# So this may fail.
for t in module.GetTypes():
n = self.canonicalTypeName(t.GetName())
self.types_[n] = t
return self.types_.get(self.canonicalTypeName(name))
except:
pass
typeobj = self.target.FindFirstType(name + '*')
if typeobj.IsValid():
return typeob.GetPointeeType()
typeobj = self.target.FindFirstType(name + '&')
if typeobj.IsValid():
return typeob.GetReferencedType()
if name.endswith('*'):
typeobj = self.target.FindFirstType(name[:-1].strip())
if typeobj.IsValid():
return typeobj.GetPointerType()
#self.warn("LOOKUP RESULT: %s" % typeobj.name)
#self.warn("LOOKUP VALID: %s" % typeobj.IsValid())
needle = self.canonicalTypeName(name)
#self.warn("NEEDLE: %s " % needle)
for i in xrange(self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(i)
# SBModule.GetType is new somewhere after early 300.x
# So this may fail.
for t in module.GetTypes():
n = self.canonicalTypeName(t.GetName())
if n == needle:
#self.warn("FOUND TYPE DIRECT 2: %s " % t)
return t
if n == needle + '*':
#self.warn("FOUND TYPE BY POINTER 2: %s " % t.GetPointeeType())
return t.GetPointeeType()
if n == needle + '&':
#self.warn("FOUND TYPE BY REFERENCE 2: %s " % t)
return t.GetDereferencedType()
#self.warn("NOT FOUND: %s " % needle)
return None
def setupInferior(self, args):
......
......@@ -281,15 +281,15 @@ def qdump__std__multimap(d, value):
return qdump__std__map(d, value)
def stdTreeIteratorHelper(d, value):
node = value["_M_node"].dereference()
node = value["_M_node"]
d.putNumChild(1)
d.putEmptyValue()
if d.isExpanded():
nodeTypeName = str(value.type).replace("_Rb_tree_iterator", "_Rb_tree_node", 1)
nodeTypeName = nodeTypeName.replace("_Rb_tree_const_iterator", "_Rb_tree_node", 1)
nodeType = d.lookupType(nodeTypeName)
data = node.cast(nodeType)["_M_value_field"]
with Children(d):
nodeTypeName = str(value.type).replace("_Rb_tree_iterator", "_Rb_tree_node", 1)
nodeTypeName = nodeTypeName.replace("_Rb_tree_const_iterator", "_Rb_tree_node", 1)
nodeType = d.lookupType(nodeTypeName + '*')
data = node.cast(nodeType).dereference()["_M_value_field"]
first = d.childWithName(data, "first")
if first:
d.putSubItem("first", first)
......
Supports Markdown
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