Commit ffadc5bf authored by hjk's avatar hjk

Debugger: Remove duplicated code

Change-Id: If95fc2b7869737224e5a39b3d32cd59afd5105ca
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 209bad42
......@@ -2153,29 +2153,6 @@ class Dumper:
with Children(self):
self.putFields(value)
def tryPutObjectNameValue(self, value):
try:
# Is this derived from QObject?
dd = value["d_ptr"]["d"]
privateTypeName = self.ns + "QObjectPrivate"
privateType = lookupType(privateTypeName)
staticMetaObject = value["staticMetaObject"]
d_ptr = dd.cast(privateType.pointer()).dereference()
objectName = None
try:
objectName = d_ptr["objectName"]
except: # Qt 5
p = d_ptr["extraData"]
if not isNull(p):
objectName = p.dereference()["objectName"]
if not objectName is None:
data, size, alloc = self.stringData(objectName)
if size > 0:
str = readRawMemory(data, 2 * size)
self.putValue(str, Hex4EncodedLittleEndian, 1)
except:
pass
def readRawMemory(self, base, size):
return readRawMemory(base, size)
......
......@@ -95,6 +95,7 @@ Dumper.isMapCompact = \
lambda d, keyType, valueType: qMapCompact(d.currentItemFormat(), keyType, valueType)
# Returns True when it encounters a QObject or derived class.
def tryPutObjectNameValue(d, value):
try:
# Is this derived from QObject?
......@@ -114,8 +115,9 @@ def tryPutObjectNameValue(d, value):
if size > 0:
str = d.readRawMemory(data, 2 * size)
d.putValue(str, Hex4EncodedLittleEndian, 1)
return True
except:
pass
return False
Dumper.tryPutObjectNameValue = tryPutObjectNameValue
......
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