forked from qt-creator/qt-creator
debugger: fix QObject identification
This commit is contained in:
@@ -1141,6 +1141,8 @@ SalCommand()
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
qqQObjectCache = {}
|
||||||
|
|
||||||
class Dumper:
|
class Dumper:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.output = ""
|
self.output = ""
|
||||||
@@ -1154,6 +1156,25 @@ class Dumper:
|
|||||||
self.currentType = None
|
self.currentType = None
|
||||||
self.currentTypePriority = -100
|
self.currentTypePriority = -100
|
||||||
|
|
||||||
|
def checkForQObjectBase(self, type):
|
||||||
|
if type.code != gdb.TYPE_CODE_STRUCT:
|
||||||
|
return False
|
||||||
|
name = str(type)
|
||||||
|
if name in qqQObjectCache:
|
||||||
|
return qqQObjectCache[name]
|
||||||
|
if name == self.ns + "QObject":
|
||||||
|
qqQObjectCache[name] = True
|
||||||
|
return True
|
||||||
|
fields = type.strip_typedefs().fields()
|
||||||
|
if len(fields) == 0:
|
||||||
|
qqQObjectCache[name] = False
|
||||||
|
return False
|
||||||
|
base = fields[0].type.strip_typedefs()
|
||||||
|
result = self.checkForQObjectBase(base)
|
||||||
|
qqQObjectCache[name] = result
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def put(self, value):
|
def put(self, value):
|
||||||
self.output += value
|
self.output += value
|
||||||
|
|
||||||
@@ -1338,11 +1359,7 @@ class Dumper:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Is this derived from QObject?
|
# Is this derived from QObject?
|
||||||
hasMetaObject = False
|
isQObjectDerived = self.checkForQObjectBase(typedefStrippedType)
|
||||||
for field in typedefStrippedType.strip_typedefs().fields():
|
|
||||||
if field.name == "staticMetaObject":
|
|
||||||
hasMetaObject = True
|
|
||||||
break
|
|
||||||
|
|
||||||
nsStrippedType = self.stripNamespaceFromType(typedefStrippedType)\
|
nsStrippedType = self.stripNamespaceFromType(typedefStrippedType)\
|
||||||
.replace("::", "__")
|
.replace("::", "__")
|
||||||
@@ -1354,10 +1371,10 @@ class Dumper:
|
|||||||
|
|
||||||
if self.useFancy \
|
if self.useFancy \
|
||||||
and ((format is None) or (format >= 1)) \
|
and ((format is None) or (format >= 1)) \
|
||||||
and ((nsStrippedType in self.dumpers) or hasMetaObject):
|
and ((nsStrippedType in self.dumpers) or isQObjectDerived):
|
||||||
#warn("IS DUMPABLE: %s " % type)
|
#warn("IS DUMPABLE: %s " % type)
|
||||||
self.putType(item.value.type)
|
self.putType(item.value.type)
|
||||||
if hasMetaObject:
|
if isQObjectDerived:
|
||||||
# value has references stripped off item.value.
|
# value has references stripped off item.value.
|
||||||
item1 = Item(value, item.iname)
|
item1 = Item(value, item.iname)
|
||||||
qdump__QObject(self, item1)
|
qdump__QObject(self, item1)
|
||||||
|
Reference in New Issue
Block a user