forked from qt-creator/qt-creator
debugger: prepare profiling of python dumpers
This commit is contained in:
@@ -8,6 +8,8 @@ import gdb
|
||||
import base64
|
||||
import __builtin__
|
||||
import os
|
||||
import cProfile
|
||||
|
||||
|
||||
# Fails on Windows.
|
||||
try:
|
||||
@@ -776,6 +778,15 @@ class FrameCommand(gdb.Command):
|
||||
super(FrameCommand, self).__init__("bb", gdb.COMMAND_OBSCURE)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
#if args.startswith('options:pp'):
|
||||
# cProfile.run('bb("%s")' % args, '/tmp/fooprof')
|
||||
#else:
|
||||
bb(args)
|
||||
|
||||
FrameCommand()
|
||||
|
||||
|
||||
def bb(args):
|
||||
options = []
|
||||
varList = []
|
||||
typeformats = {}
|
||||
@@ -813,7 +824,7 @@ class FrameCommand(gdb.Command):
|
||||
#warn("VARIABLES: %s" % varList)
|
||||
#warn("EXPANDED INAMES: %s" % expandedINames)
|
||||
module = sys.modules[__name__]
|
||||
self.dumpers = {}
|
||||
dumpers = {}
|
||||
|
||||
if False:
|
||||
dumpers = ""
|
||||
@@ -836,10 +847,10 @@ class FrameCommand(gdb.Command):
|
||||
if useFancy:
|
||||
for key, value in module.__dict__.items():
|
||||
if key.startswith("qdump__"):
|
||||
self.dumpers[key[7:]] = value
|
||||
dumpers[key[7:]] = value
|
||||
|
||||
d = Dumper()
|
||||
d.dumpers = self.dumpers
|
||||
d.dumpers = dumpers
|
||||
d.typeformats = typeformats
|
||||
d.formats = formats
|
||||
d.useFancy = useFancy
|
||||
@@ -938,7 +949,7 @@ class FrameCommand(gdb.Command):
|
||||
if len(watchers) > 0:
|
||||
for watcher in watchers.split("##"):
|
||||
(exp, iname) = watcher.split("#")
|
||||
self.handleWatch(d, exp, iname)
|
||||
handleWatch(d, exp, iname)
|
||||
|
||||
#
|
||||
# Breakpoints
|
||||
@@ -949,7 +960,7 @@ class FrameCommand(gdb.Command):
|
||||
print('data=[' + d.output + ']')
|
||||
|
||||
|
||||
def handleWatch(self, d, exp, iname):
|
||||
def handleWatch(d, exp, iname):
|
||||
exp = str(exp)
|
||||
escapedExp = exp.replace('"', '\\"');
|
||||
#warn("HANDLING WATCH %s, INAME: '%s'" % (exp, iname))
|
||||
@@ -968,7 +979,7 @@ class FrameCommand(gdb.Command):
|
||||
with Children(d, len(list)):
|
||||
itemNumber = 0
|
||||
for item in list:
|
||||
self.handleWatch(d, item, "%s.%d" % (iname, itemNumber))
|
||||
handleWatch(d, item, "%s.%d" % (iname, itemNumber))
|
||||
itemNumber += 1
|
||||
except RuntimeError, error:
|
||||
warn("EVAL: ERROR CAUGHT %s" % error)
|
||||
@@ -997,8 +1008,6 @@ class FrameCommand(gdb.Command):
|
||||
d.put('value="<invalid>",type="<unknown>",numchild="0",')
|
||||
|
||||
|
||||
FrameCommand()
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
|
Reference in New Issue
Block a user