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 <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-13 09:18:27 +01:00
parent 2de389548c
commit a7fce39103
4 changed files with 10 additions and 5 deletions

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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);