Commit 03c6df1f authored by hjk's avatar hjk
Browse files

Debugger: Fix staticMetaObject extraction with LLDB



When asked for Foo::staticMetaObject, it will find
any *::staticMetaObject. Looking for the mangled name
finds the one we need.

Change-Id: I4508a3c282bc8a46efa011efb73f32cdbf46398c
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 7d6c823b
......@@ -969,8 +969,7 @@ class DumperBase:
if typeName.find('<') >= 0:
return 0
staticMetaObjectName = typeName + "::staticMetaObject"
result = self.findSymbol(staticMetaObjectName)
result = self.findStaticMetaObject(typeName)
# We need to distinguish Q_OBJECT from Q_GADGET:
# a Q_OBJECT SMO has a non-null superdata (unless it's QObject itself),
......
......@@ -861,6 +861,9 @@ class Dumper(DumperBase):
def extractByte(self, addr):
return struct.unpack("b", self.readRawMemory(addr, 1))[0]
def findStaticMetaObject(self, typeName):
return self.findSymbol(typeName + "::staticMetaObject")
def findSymbol(self, symbolName):
try:
result = gdb.lookup_global_symbol(symbolName)
......
......@@ -883,6 +883,13 @@ class Dumper(DumperBase):
buf[i] = data.GetUnsignedInt8(error, i)
return Blob(bytes(buf))
def mangleName(self, typeName):
return '_ZN%sE' % ''.join(map(lambda x: "%d%s" % (len(x), x), typeName.split('::')))
def findStaticMetaObject(self, typeName):
symbolName = self.mangleName(typeName + '::staticMetaObject')
return self.target.FindFirstGlobalVariable(symbolName)
def findSymbol(self, symbolName):
return self.target.FindFirstGlobalVariable(symbolName)
......
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