diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 379db22d2c764e8df32408e10b825e485886c40f..e8966afea4ed72ca981de5f01aa79ae86c36dbd5 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -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) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 1141c85943fc0a4e503cf0fc7cd2fb9644eaa8d5..aee9b572db50628fbe4f94803d3bdf068ab0780c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1727,25 +1727,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response) { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); 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; data.fromStringMultiple(response.consoleStreamOutput); const GdbMi dumpers = data["dumpers"]; @@ -4350,14 +4331,23 @@ void GdbEngine::startGdb(const QStringList &args) const GdbCommandFlags flags = ConsoleCommand | Immediate; postCommand("python sys.path.insert(1, '" + dumperSourcePath + "')", 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::loadInitScript() { const QString script = startParameters().overrideStartScript;