Commit 875d8890 authored by hjk's avatar hjk
Browse files

Debugger: Move bbsetup over to runCommand()



Change-Id: I0a19b28d24cb570651ea84bf7cdbc9a761f85a0b
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent f65cb6ae
......@@ -1672,7 +1672,7 @@ class DumperBase:
except:
pass
def findDumperFunctions(self):
def setupDumper(self, _ = {}):
self.qqDumpers = {}
self.qqFormats = {}
self.qqEditable = {}
......@@ -1687,7 +1687,7 @@ class DumperBase:
return self.reportDumpers()
def reportDumpers(self):
def reportDumpers(self, _ = {}):
result = "dumpers=["
for key, value in self.qqFormats.items():
if key in self.qqEditable:
......@@ -1705,7 +1705,7 @@ class DumperBase:
else:
reload(m)
findDumperFunctions()
setupDumper()
def addDumperModule(self, args):
path = args['path']
......
......@@ -135,12 +135,6 @@ class ScanStackCommand(gdb.Command):
ScanStackCommand()
def bbsetup(args = ''):
print(theDumper.findDumperFunctions())
registerCommand("bbsetup", bbsetup)
#######################################################################
#
# Import plain gdb pretty printers
......
......@@ -1693,7 +1693,7 @@ class Dumper(DumperBase):
self.report(result + ']')
def loadDumperFiles(self, _ = None):
result = self.findDumperFunctions()
result = self.setupDumper()
self.report(result)
def fetchMemory(self, args):
......
......@@ -45,8 +45,12 @@ class DebuggerResponse;
class DebuggerCommand
{
public:
typedef std::function<void(const DebuggerResponse &)> Callback;
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) {}
void arg(const char *name);
......@@ -64,8 +68,6 @@ public:
static QByteArray toData(const QList<QByteArray> &value);
static QByteArray toData(const QHash<QByteArray, QByteArray> &value);
typedef std::function<void(const DebuggerResponse &)> Callback;
QByteArray function;
QByteArray args;
Callback callback;
......
......@@ -4295,7 +4295,7 @@ void GdbEngine::startGdb(const QStringList &args)
if (!commands.isEmpty())
postCommand(commands.toLocal8Bit(), flags);
postCommand("bbsetup", flags, CB(handlePythonSetup));
runCommand(DebuggerCommand("setupDumper", flags, CB(handlePythonSetup)));
}
void GdbEngine::handleGdbStartFailed()
......
......@@ -1236,7 +1236,7 @@ void tst_Dumpers::dumper()
cmds += "python sys.path.insert(1, '" + dumperDir + "')\n"
"python sys.path.append('" + uninstalledData + "')\n"
"python from gdbbridge import *\n"
"bbsetup\n"
"python theDumper.setupDumper()\n"
"run " + nograb + "\n"
"bb options:fancy,forcens,autoderef,dyntype,pe vars: expanded:" + expanded + " typeformats:\n";
......
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