From a7fce3910378ec2f6289e1707649cffc45540817 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2015 09:18:27 +0100 Subject: [PATCH] Debugger: Start moving PdbEngine to common Gdb/Lldb base architecture That's still not meant for "production", but just the "3rd use case needed to get abstractions right". For testing, remove all build steps, and use a custom run step with executable /usr/bin/python and argument pointing to the main .py file. Change-Id: I6ae6ed08597896ea979ee58e73c546c7892e8be2 Reviewed-by: Christian Stenger --- .../qtcreator/debugger/{pdumper.py => pdbbridge.py} | 0 src/plugins/debugger/debuggerruncontrol.cpp | 2 +- src/plugins/debugger/pdb/pdbengine.cpp | 12 ++++++++---- src/plugins/debugger/pdb/pdbengine.h | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) rename share/qtcreator/debugger/{pdumper.py => pdbbridge.py} (100%) diff --git a/share/qtcreator/debugger/pdumper.py b/share/qtcreator/debugger/pdbbridge.py similarity index 100% rename from share/qtcreator/debugger/pdumper.py rename to share/qtcreator/debugger/pdbbridge.py diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 48c5cb24d63..dc5711d30b3 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -402,7 +402,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate } if (sp.masterEngineType == NoEngineType) { - if (sp.executable.endsWith(_(".py"))) { + if (sp.executable.endsWith(_(".py")) || sp.executable == _("/usr/bin/python")) { sp.masterEngineType = PdbEngineType; } else { if (RunConfiguration *rc = sp.runConfiguration) { diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index a6a2acb2268..286d82fceca 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -195,7 +195,7 @@ void PdbEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); - QString fileName = QFileInfo(startParameters().executable).absoluteFilePath(); + QString fileName = mainPythonFile(); QFile scriptFile(fileName); if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { Core::AsynchronousMessageBox::critical(tr("Python Error"), @@ -207,17 +207,21 @@ void PdbEngine::setupInferior() notifyInferiorSetupOk(); } +QString PdbEngine::mainPythonFile() const +{ + return QFileInfo(startParameters().processArgs).absoluteFilePath(); +} + void PdbEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); showStatusMessage(tr("Running requested..."), 5000); const QByteArray dumperSourcePath = Core::ICore::resourcePath().toLocal8Bit() + "/debugger/"; - QString fileName = QFileInfo(startParameters().executable).absoluteFilePath(); postDirectCommand("import sys"); - postDirectCommand("sys.argv.append('" + fileName.toLocal8Bit() + "')"); + postDirectCommand("sys.argv.append('" + mainPythonFile().toLocal8Bit() + "')"); postDirectCommand("execfile('/usr/bin/pdb')"); - postDirectCommand("execfile('" + dumperSourcePath + "pdumper.py')"); + postDirectCommand("execfile('" + dumperSourcePath + "pdbbridge.py')"); attemptBreakpointSynchronization(); notifyEngineRunAndInferiorStopOk(); continueInferior(); diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h index 41dc68a119a..a6ace0ef861 100644 --- a/src/plugins/debugger/pdb/pdbengine.h +++ b/src/plugins/debugger/pdb/pdbengine.h @@ -108,6 +108,7 @@ private: bool supportsThreads() const { return true; } bool isSynchronous() const { return true; } void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags); + QString mainPythonFile() const; signals: void outputReady(const QByteArray &data);