Commit a7fce391 authored by hjk's avatar hjk

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: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 2de38954
...@@ -402,7 +402,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate ...@@ -402,7 +402,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate
} }
if (sp.masterEngineType == NoEngineType) { if (sp.masterEngineType == NoEngineType) {
if (sp.executable.endsWith(_(".py"))) { if (sp.executable.endsWith(_(".py")) || sp.executable == _("/usr/bin/python")) {
sp.masterEngineType = PdbEngineType; sp.masterEngineType = PdbEngineType;
} else { } else {
if (RunConfiguration *rc = sp.runConfiguration) { if (RunConfiguration *rc = sp.runConfiguration) {
......
...@@ -195,7 +195,7 @@ void PdbEngine::setupInferior() ...@@ -195,7 +195,7 @@ void PdbEngine::setupInferior()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
QString fileName = QFileInfo(startParameters().executable).absoluteFilePath(); QString fileName = mainPythonFile();
QFile scriptFile(fileName); QFile scriptFile(fileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
Core::AsynchronousMessageBox::critical(tr("Python Error"), Core::AsynchronousMessageBox::critical(tr("Python Error"),
...@@ -207,17 +207,21 @@ void PdbEngine::setupInferior() ...@@ -207,17 +207,21 @@ void PdbEngine::setupInferior()
notifyInferiorSetupOk(); notifyInferiorSetupOk();
} }
QString PdbEngine::mainPythonFile() const
{
return QFileInfo(startParameters().processArgs).absoluteFilePath();
}
void PdbEngine::runEngine() void PdbEngine::runEngine()
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
showStatusMessage(tr("Running requested..."), 5000); showStatusMessage(tr("Running requested..."), 5000);
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath =
Core::ICore::resourcePath().toLocal8Bit() + "/debugger/"; Core::ICore::resourcePath().toLocal8Bit() + "/debugger/";
QString fileName = QFileInfo(startParameters().executable).absoluteFilePath();
postDirectCommand("import sys"); postDirectCommand("import sys");
postDirectCommand("sys.argv.append('" + fileName.toLocal8Bit() + "')"); postDirectCommand("sys.argv.append('" + mainPythonFile().toLocal8Bit() + "')");
postDirectCommand("execfile('/usr/bin/pdb')"); postDirectCommand("execfile('/usr/bin/pdb')");
postDirectCommand("execfile('" + dumperSourcePath + "pdumper.py')"); postDirectCommand("execfile('" + dumperSourcePath + "pdbbridge.py')");
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
notifyEngineRunAndInferiorStopOk(); notifyEngineRunAndInferiorStopOk();
continueInferior(); continueInferior();
......
...@@ -108,6 +108,7 @@ private: ...@@ -108,6 +108,7 @@ private:
bool supportsThreads() const { return true; } bool supportsThreads() const { return true; }
bool isSynchronous() const { return true; } bool isSynchronous() const { return true; }
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags); void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
QString mainPythonFile() const;
signals: signals:
void outputReady(const QByteArray &data); void outputReady(const QByteArray &data);
......
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