Commit 5c74244e authored by hjk's avatar hjk
Browse files

Debugger: Try to find more types with LLDB



The actual problem is that LLDB considers types that differ
only in spacing of the "name" (i.e. "foo *" and "foo*") as
different and can not look them up with the "wrong" name.

Change-Id: Iff79436b6a13a40de9b7b669bece2204ac858edb
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 9b42244d
...@@ -312,6 +312,7 @@ class Dumper(DumperBase): ...@@ -312,6 +312,7 @@ class Dumper(DumperBase):
self.isShuttingDown_ = False self.isShuttingDown_ = False
self.isInterrupting_ = False self.isInterrupting_ = False
self.dummyValue = None self.dummyValue = None
self.types_ = {}
def enterSubItem(self, item): def enterSubItem(self, item):
if isinstance(item.name, lldb.SBValue): if isinstance(item.name, lldb.SBValue):
...@@ -614,15 +615,32 @@ class Dumper(DumperBase): ...@@ -614,15 +615,32 @@ class Dumper(DumperBase):
return xrange(0, self.currentNumChild) return xrange(0, self.currentNumChild)
return xrange(min(self.currentMaxNumChild, self.currentNumChild)) return xrange(min(self.currentMaxNumChild, self.currentNumChild))
def canonicalTypeName(self, name):
return re.sub('\\bconst\\b', '', name).replace(' ', '')
def lookupType(self, name): def lookupType(self, name):
#warn("LOOKUP TYPE NAME: %s" % name) #warn("LOOKUP TYPE NAME: %s" % name)
if name.endswith('*'): if name.endswith('*'):
type = self.lookupType(name[:-1].strip()) typeobj = self.lookupType(name[:-1].strip())
return type.GetPointerType() if type.IsValid() else None return typeobj.GetPointerType() if type.IsValid() else None
type = self.target.FindFirstType(name) typeobj = self.target.FindFirstType(name)
#warn("LOOKUP RESULT: %s" % type.name) #warn("LOOKUP RESULT: %s" % typeobj.name)
#warn("LOOKUP VALID: %s" % type.IsValid()) #warn("LOOKUP VALID: %s" % typeobj.IsValid())
return type if type.IsValid() else None 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
return None
def setupInferior(self, args): def setupInferior(self, args):
error = lldb.SBError() error = lldb.SBError()
......
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