Debugger: Move bbsetup over to runCommand()

Change-Id: I0a19b28d24cb570651ea84bf7cdbc9a761f85a0b
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-11 16:38:33 +01:00
parent f65cb6ae4d
commit 875d889082
6 changed files with 11 additions and 15 deletions

View File

@@ -1672,7 +1672,7 @@ class DumperBase:
except: except:
pass pass
def findDumperFunctions(self): def setupDumper(self, _ = {}):
self.qqDumpers = {} self.qqDumpers = {}
self.qqFormats = {} self.qqFormats = {}
self.qqEditable = {} self.qqEditable = {}
@@ -1687,7 +1687,7 @@ class DumperBase:
return self.reportDumpers() return self.reportDumpers()
def reportDumpers(self): def reportDumpers(self, _ = {}):
result = "dumpers=[" result = "dumpers=["
for key, value in self.qqFormats.items(): for key, value in self.qqFormats.items():
if key in self.qqEditable: if key in self.qqEditable:
@@ -1705,7 +1705,7 @@ class DumperBase:
else: else:
reload(m) reload(m)
findDumperFunctions() setupDumper()
def addDumperModule(self, args): def addDumperModule(self, args):
path = args['path'] path = args['path']

View File

@@ -135,12 +135,6 @@ class ScanStackCommand(gdb.Command):
ScanStackCommand() ScanStackCommand()
def bbsetup(args = ''):
print(theDumper.findDumperFunctions())
registerCommand("bbsetup", bbsetup)
####################################################################### #######################################################################
# #
# Import plain gdb pretty printers # Import plain gdb pretty printers

View File

@@ -1693,7 +1693,7 @@ class Dumper(DumperBase):
self.report(result + ']') self.report(result + ']')
def loadDumperFiles(self, _ = None): def loadDumperFiles(self, _ = None):
result = self.findDumperFunctions() result = self.setupDumper()
self.report(result) self.report(result)
def fetchMemory(self, args): def fetchMemory(self, args):

View File

@@ -45,8 +45,12 @@ class DebuggerResponse;
class DebuggerCommand class DebuggerCommand
{ {
public: public:
typedef std::function<void(const DebuggerResponse &)> Callback;
DebuggerCommand() : flags(0) {} DebuggerCommand() : flags(0) {}
DebuggerCommand(const char *f) : function(f), flags(0) {} DebuggerCommand(const char *f, int flags = 0, Callback cb = Callback())
: function(f), callback(cb), flags(flags)
{}
DebuggerCommand(const QByteArray &f) : function(f), flags(0) {} DebuggerCommand(const QByteArray &f) : function(f), flags(0) {}
void arg(const char *name); void arg(const char *name);
@@ -64,8 +68,6 @@ public:
static QByteArray toData(const QList<QByteArray> &value); static QByteArray toData(const QList<QByteArray> &value);
static QByteArray toData(const QHash<QByteArray, QByteArray> &value); static QByteArray toData(const QHash<QByteArray, QByteArray> &value);
typedef std::function<void(const DebuggerResponse &)> Callback;
QByteArray function; QByteArray function;
QByteArray args; QByteArray args;
Callback callback; Callback callback;

View File

@@ -4295,7 +4295,7 @@ void GdbEngine::startGdb(const QStringList &args)
if (!commands.isEmpty()) if (!commands.isEmpty())
postCommand(commands.toLocal8Bit(), flags); postCommand(commands.toLocal8Bit(), flags);
postCommand("bbsetup", flags, CB(handlePythonSetup)); runCommand(DebuggerCommand("setupDumper", flags, CB(handlePythonSetup)));
} }
void GdbEngine::handleGdbStartFailed() void GdbEngine::handleGdbStartFailed()

View File

@@ -1236,7 +1236,7 @@ void tst_Dumpers::dumper()
cmds += "python sys.path.insert(1, '" + dumperDir + "')\n" cmds += "python sys.path.insert(1, '" + dumperDir + "')\n"
"python sys.path.append('" + uninstalledData + "')\n" "python sys.path.append('" + uninstalledData + "')\n"
"python from gdbbridge import *\n" "python from gdbbridge import *\n"
"bbsetup\n" "python theDumper.setupDumper()\n"
"run " + nograb + "\n" "run " + nograb + "\n"
"bb options:fancy,forcens,autoderef,dyntype,pe vars: expanded:" + expanded + " typeformats:\n"; "bb options:fancy,forcens,autoderef,dyntype,pe vars: expanded:" + expanded + " typeformats:\n";