Commit 8b64e859 authored by hjk's avatar hjk

Debugger: Make LLDB dumpers work for namespaced Qt

Change-Id: Ife3d65cc6617a07dffd43c8ef0f0a734b3f11331
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 985d9b7b
......@@ -425,22 +425,43 @@ class Dumper(DumperBase):
def isStructType(self, typeobj):
return typeobj.GetTypeClass() in (lldb.eTypeClassStruct, lldb.eTypeClassClass)
def qtVersion(self):
def qtVersionAndNamespace(self):
self.cachedQtNamespace = ""
self.cachedQtVersion = 0x0
coreExpression = re.compile(r"(lib)?Qt5?Core")
for n in range(0, self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(n)
if coreExpression.match(module.GetFileSpec().GetFilename()):
# Extract version.
reverseVersion = module.GetVersion()
reverseVersion.reverse()
shift = 0
for v in reverseVersion:
self.cachedQtVersion += v << shift
shift += 8
# Look for some Qt symbol to extract namespace.
for symbol in module.symbols:
name = symbol.GetName()
pos = name.find("QString")
if pos >= 0:
name = name[:pos]
if name.endswith("::"):
self.cachedQtNamespace = re.sub('^.*[^\w]([\w]+)::$', '\\1', name) + '::'
break
break
# Memoize good results.
self.qtNamespace = lambda: self.cachedQtNamespace
self.qtVersion = lambda: self.cachedQtVersion
def qtNamespace(self):
self.qtVersionAndNamespace()
return self.cachedQtNamespace
def qtVersion(self):
self.extraceqtVersionAndNamespace()
return self.cachedQtVersion
def intSize(self):
......@@ -782,16 +803,12 @@ class Dumper(DumperBase):
except:
return False
def qtNamespace(self):
# FIXME
return ""
def stripNamespaceFromType(self, typeName):
#type = stripClassTag(typeName)
type = typeName
#ns = qtNamespace()
#if len(ns) > 0 and type.startswith(ns):
# type = type[len(ns):]
ns = self.qtNamespace()
if len(ns) > 0 and type.startswith(ns):
type = type[len(ns):]
pos = type.find("<")
# FIXME: make it recognize foo<A>::bar<B>::iterator?
while pos != -1:
......
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