Commit cca10304 authored by hjk's avatar hjk

Debugger: Add python command to add dumpers

More flexible than hacking on the C++ side. Also registers
the custom dumper path to make it reloadable like the
"built-in" dumpers.

Change-Id: I0405f7278e28eb75d83fdd4a861f5a5c32d97a0e
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent fbcff211
...@@ -1930,8 +1930,14 @@ registerCommand("stackListFrames", stackListFrames) ...@@ -1930,8 +1930,14 @@ registerCommand("stackListFrames", stackListFrames)
####################################################################### #######################################################################
# #
# Mixed C++/Qml debugging # AddExtraDumpers Command
# #
####################################################################### #######################################################################
bbsetup() def addExtraDumper(args):
(head, tail) = os.path.split(args)
sys.path.insert(1, head)
dumpermodules.append(os.path.splitext(tail)[0])
return str((head, tail))
registerCommand("addExtraDumper", addExtraDumper)
...@@ -1727,25 +1727,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response) ...@@ -1727,25 +1727,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
{ {
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
bool needSetup = false;
const QString path = stringSetting(ExtraDumperFile);
if (!path.isEmpty()) {
QFileInfo fi(path);
postCommand("python sys.path.insert(1, '" + fi.absolutePath().toUtf8() + "')");
postCommand("python from " + fi.baseName().toUtf8() + " import *");
needSetup = true;
}
const QString commands = stringSetting(ExtraDumperCommands);
if (!commands.isEmpty()) {
postCommand(commands.toLocal8Bit());
needSetup = true;
}
if (needSetup)
postCommand("bbsetup");
GdbMi data; GdbMi data;
data.fromStringMultiple(response.consoleStreamOutput); data.fromStringMultiple(response.consoleStreamOutput);
const GdbMi dumpers = data["dumpers"]; const GdbMi dumpers = data["dumpers"];
...@@ -4350,14 +4331,23 @@ void GdbEngine::startGdb(const QStringList &args) ...@@ -4350,14 +4331,23 @@ void GdbEngine::startGdb(const QStringList &args)
const GdbCommandFlags flags = ConsoleCommand | Immediate; const GdbCommandFlags flags = ConsoleCommand | Immediate;
postCommand("python sys.path.insert(1, '" + dumperSourcePath + "')", flags); postCommand("python sys.path.insert(1, '" + dumperSourcePath + "')", flags);
postCommand("python sys.path.append('" + uninstalledData + "')", flags); postCommand("python sys.path.append('" + uninstalledData + "')", flags);
postCommand("python from gdbbridge import *", flags, CB(handlePythonSetup)); postCommand("python from gdbbridge import *", flags);
const QString path = stringSetting(ExtraDumperFile);
if (!path.isEmpty())
postCommand("python addExtraDumper('" + path.toUtf8() + "')", flags);
const QString commands = stringSetting(ExtraDumperCommands);
if (!commands.isEmpty())
postCommand(commands.toLocal8Bit(), flags);
postCommand("bbsetup", flags, CB(handlePythonSetup));
} }
void GdbEngine::handleGdbStartFailed() void GdbEngine::handleGdbStartFailed()
{ {
} }
void GdbEngine::loadInitScript() void GdbEngine::loadInitScript()
{ {
const QString script = startParameters().overrideStartScript; const QString script = startParameters().overrideStartScript;
......
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