Commit 539e33da authored by hjk's avatar hjk Committed by hjk

Debugger: Improve QObject related dumpers in release builds

Make QMeta* dumper work without debug info.
Show QObject parent and children list in this case.

QObject properties are not visible, and neither actual type
of QObject children.

Change-Id: I05417a7d78084234403a964f683db6867b6686f0
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 96e877d3
This diff is collapsed.
......@@ -383,13 +383,9 @@ class Dumper(DumperBase):
def canCallLocale(self):
return False if self.is32bit() else True
def reportTime(self, hint):
#from datetime import datetime
#warn("%s: %s" % (hint, datetime.now().time().isoformat()))
pass
def fetchVariables(self, args):
self.reportTime("begin fetch")
self.resetStats()
self.preping("locals")
self.prepare(args)
partialVariable = args.get("partialvar", "")
isPartial = len(partialVariable) > 0
......@@ -425,7 +421,7 @@ class Dumper(DumperBase):
else:
locals = self.listOfLocals()
self.reportTime("locals")
self.ping("locals")
# Take care of the return value of the last function call.
if len(self.resultVarName) > 0:
......@@ -449,12 +445,16 @@ class Dumper(DumperBase):
else:
# A "normal" local variable or parameter.
with TopLevelItem(self, item.iname):
self.preping("all-" + item.iname)
self.put('iname="%s",' % item.iname)
self.put('name="%s",' % item.name)
self.putItem(value)
self.ping("all-" + item.iname)
self.preping("watches")
with OutputSafer(self):
self.handleWatches(args)
self.ping("watches")
self.output.append('],typeinfo=[')
for name in self.typesToReport.keys():
......@@ -475,9 +475,10 @@ class Dumper(DumperBase):
self.output.append(',partial="%d"' % isPartial)
self.reportTime("before print: %s" % len(self.output))
self.preping('safePrint')
safePrint(''.join(self.output))
self.reportTime("after print")
self.ping('safePrint')
safePrint('"%s"' % str(self.dumpStats()))
def enterSubItem(self, item):
if not item.iname:
......@@ -800,10 +801,12 @@ class Dumper(DumperBase):
return struct.unpack("b", self.readRawMemory(address, 1))[0]
def findStaticMetaObject(self, typename):
return self.findSymbol(typename + "::staticMetaObject")
symbol = gdb.lookup_global_symbol(typename + "::staticMetaObject")
return toInteger(symbol.value().address) if symbol else 0
def findSymbol(self, symbolName):
try:
self.bump('findSymbol1')
result = gdb.lookup_global_symbol(symbolName)
return result.value() if result else 0
except:
......@@ -812,9 +815,11 @@ class Dumper(DumperBase):
try:
address = gdb.parse_and_eval("&'%s'" % symbolName)
typeobj = gdb.lookup_type(self.qtNamespace() + "QMetaObject")
self.bump('findSymbol2')
return self.createPointerValue(address, typeobj)
except:
return 0
self.bump('findSymbol3')
return 0
def put(self, value):
self.output.append(value)
......
......@@ -900,6 +900,10 @@ class Dumper(DumperBase):
# logview pane feature.
self.report('token(\"%s\")' % args["token"])
def readRawMemory(self, address, size):
error = lldb.SBError()
return self.process.ReadMemory(address, size, error)
def extractBlob(self, base, size):
if size == 0:
return Blob("")
......@@ -923,7 +927,8 @@ class Dumper(DumperBase):
def findStaticMetaObject(self, typeName):
symbolName = self.mangleName(typeName + '::staticMetaObject')
return self.target.FindFirstGlobalVariable(symbolName)
symbol = self.target.FindFirstGlobalVariable(symbolName)
return int(symbol.AddressOf()) if symbol.IsValid() else 0
def findSymbol(self, symbolName):
return self.target.FindFirstGlobalVariable(symbolName)
......
......@@ -1106,7 +1106,7 @@ def qdump__QMetaObject(d, value):
d.putNumChild(1)
if d.isExpanded():
with Children(d):
d.putQObjectGutsHelper(0, 0, -1, value, "QMetaObject")
d.putQObjectGutsHelper(0, 0, -1, d.addressOf(value), "QMetaObject")
d.putMembersItem(value)
......
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