Commit 762f3e32 authored by hjk's avatar hjk

Debugger: Fix metaobject lookuop for older versions of GDB

Symbol.value is not available in 7.4

Change-Id: I86e00cbeef61669ca5950e35a7b0aed86dcb2f87
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 41f25565
......@@ -833,6 +833,17 @@ class Dumper(DumperBase):
def extractByte(self, addr):
return struct.unpack("b", self.readRawMemory(addr, 1))[0]
def findSymbol(self, symbolName):
try:
result = gdb.lookup_global_symbol(symbolName)
return result.value() if result else 0
except:
pass
# Older GDB ~7.4
try:
return gdb.parse_and_eval(symbolName)
except:
return 0
def extractStaticMetaObjectHelper(self, typeName):
"""
......@@ -844,15 +855,7 @@ class Dumper(DumperBase):
return 0
staticMetaObjectName = typeName + "::staticMetaObject"
if hasattr(gdb, 'lookup_global_symbol'):
result = gdb.lookup_global_symbol(staticMetaObjectName)
result = result.value() if result else 0
else:
# Older GDB...
try:
result = gdb.parse_and_eval(staticMetaObjectName)
except:
result = 0
result = self.findSymbol(staticMetaObjectName)
# We need to distinguish Q_OBJECT from Q_GADGET:
# a Q_OBJECT SMO has a non-null superdata (unless it's QObject itself),
......
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