diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 8e41cfad7f9be9752b2e45cdcac86b339913db1e..dcdb33c605930c48ecd15c0a788280f1bf8fdfdf 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -843,7 +843,7 @@ public slots: QVariant configValue(const QString &name) const { return settings()->value(name); } - ProjectExplorer::RunControl *createDebugger(const DebuggerStartParameters &sp); + DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp); void startDebugger(ProjectExplorer::RunControl *runControl); void dumpLog(); @@ -1914,7 +1914,7 @@ void DebuggerPluginPrivate::showToolTip(ITextEditor *editor, const QPoint &point notifyCurrentEngine(RequestToolTipByExpressionRole, list); } -ProjectExplorer::RunControl * +DebuggerRunControl * DebuggerPluginPrivate::createDebugger(const DebuggerStartParameters &sp) { return m_debuggerRunControlFactory->create(sp); @@ -1922,8 +1922,8 @@ DebuggerPluginPrivate::createDebugger(const DebuggerStartParameters &sp) void DebuggerPluginPrivate::startDebugger(ProjectExplorer::RunControl *rc) { + QTC_ASSERT(rc, return); DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(rc); - qDebug() << "START DEBUGGER: " << runControl << rc; QTC_ASSERT(runControl, return); activateDebugMode(); connectEngine(runControl->engine()); @@ -2576,7 +2576,7 @@ QWidget *DebuggerPlugin::mainWindow() const return d->m_uiSwitcher->mainWindow(); } -ProjectExplorer::RunControl * +DebuggerRunControl * DebuggerPlugin::createDebugger(const DebuggerStartParameters &sp) { return instance()->d->createDebugger(sp); diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 1a50245973665b55d2a70135e753166d88b9a630..61e87d7ebbe34b1bf34d17d9ca3af7dd634f6e99 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -83,8 +83,7 @@ public: void readSettings(); void writeSettings() const; - static ProjectExplorer::RunControl *createDebugger - (const DebuggerStartParameters &sp); + static DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp); static void startDebugger(ProjectExplorer::RunControl *runControl); QMessageBox *showMessageBox(int icon, const QString &title, diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 61afe22be2360afd3439f69e742578caee943367..9c38c145008d8b48d2df57e4ab8ec4e051ad4d9a 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -171,7 +171,7 @@ RunControl *DebuggerRunControlFactory::create return create(sp, runConfiguration); } -RunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp, +DebuggerRunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp, RunConfiguration *runConfiguration) { DebuggerRunControl *runControl = new DebuggerRunControl(runConfiguration); @@ -369,7 +369,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &sp) break; default: { // Could not find anything suitable. - emit debuggingFinished(); + debuggingFinished(); // Create Message box with possibility to go to settings const QString msg = tr("Cannot debug '%1' (tool chain: '%2'): %3") .arg(sp.executable, toolChainName(sp.toolChainType), m_errorMessage); diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h index 99938b0914709ceb65e38b90f74043cc44329927..cd32082a02697e7036493075cc244f1663f0dc6e 100644 --- a/src/plugins/debugger/debuggerrunner.h +++ b/src/plugins/debugger/debuggerrunner.h @@ -42,6 +42,7 @@ class Environment; namespace Debugger { +class DebuggerRunControl; class DebuggerStartParameters; namespace Internal { @@ -69,7 +70,7 @@ public: // This is used by the "Non-Standard" scenarios, e.g. Attach to Core. // FIXME: What to do in case of a 0 runConfiguration? - ProjectExplorer::RunControl *create(const DebuggerStartParameters &sp, + DebuggerRunControl *create(const DebuggerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); private: diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index 921efa52d938b119c65cd289aefd08c2e6eb5e84..93e059d02c583a8de2eced171d6675a93dde0878 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -64,6 +64,7 @@ namespace Internal { using ProjectExplorer::RunConfiguration; using ProjectExplorer::ToolChain; +using namespace Debugger; AbstractMaemoRunControl::AbstractMaemoRunControl(RunConfiguration *rc, QString mode) : RunControl(rc, mode) @@ -383,17 +384,17 @@ void MaemoRunControl::handleRemoteOutput(const QString &output) MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration) : AbstractMaemoRunControl(runConfiguration, ProjectExplorer::Constants::DEBUGMODE) , m_debuggerRunControl(0) - , m_startParams(new Debugger::DebuggerStartParameters) + , m_startParams(new DebuggerStartParameters) { #ifdef USE_GDBSERVER - m_startParams->startMode = Debugger::AttachToRemote; + m_startParams->startMode = AttachToRemote; m_startParams->executable = executableOnHost(); m_startParams->debuggerCommand = m_runConfig->gdbCmd(); m_startParams->remoteChannel = m_devConfig.server.host % QLatin1Char(':') % gdbServerPort(); m_startParams->remoteArchitecture = QLatin1String("arm"); #else - m_startParams->startMode = Debugger::StartRemoteGdb; + m_startParams->startMode = StartRemoteGdb; m_startParams->executable = executableFilePathOnTarget(); m_startParams->debuggerCommand = QLatin1String("/usr/bin/gdb"); m_startParams->sshserver = m_devConfig.server; @@ -405,8 +406,7 @@ MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration) m_startParams->remoteDumperLib = remoteDir().toUtf8() + '/' + QFileInfo(m_runConfig->dumperLib()).fileName().toUtf8(); - m_debuggerRunControl = qobject_cast<Debugger::DebuggerRunControl *> - (Debugger::DebuggerPlugin::createDebugger(*m_startParams.data())); + m_debuggerRunControl = DebuggerPlugin::createDebugger(*m_startParams.data()); connect(m_debuggerRunControl, SIGNAL(finished()), this, SLOT(debuggingFinished()), Qt::QueuedConnection); } @@ -453,7 +453,7 @@ void MaemoDebugRunControl::handleRemoteOutput(const QString &output) void MaemoDebugRunControl::startDebugging() { - Debugger::DebuggerPlugin::startDebugger(m_debuggerRunControl); + DebuggerPlugin::startDebugger(m_debuggerRunControl); } void MaemoDebugRunControl::stopInternal() @@ -464,7 +464,7 @@ void MaemoDebugRunControl::stopInternal() bool MaemoDebugRunControl::isRunning() const { return AbstractMaemoRunControl::isRunning() - || m_debuggerRunControl->state() != Debugger::DebuggerNotReady; + || m_debuggerRunControl->state() != DebuggerNotReady; } void MaemoDebugRunControl::debuggingFinished() diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index b4d377a123f35bbdf19699eee60066697075501d..2bd0d8d2d8b48184aae5b01cde82d842ad6dc313 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -886,20 +886,13 @@ void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) { // ======== S60DeviceDebugRunControl -S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration, QString mode) : - S60DeviceRunControlBase(runConfiguration, mode), - m_startParams(new Debugger::DebuggerStartParameters) +S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc, QString mode) : + S60DeviceRunControlBase(rc, mode), + m_startParams(new Debugger::DebuggerStartParameters), + m_debuggerRunControl(0) { setReleaseDeviceAfterLauncherFinish(true); // Debugger controls device after install - Debugger::DebuggerPlugin *dm = Debugger::DebuggerPlugin::instance(); - S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); - QTC_ASSERT(dm && rc, return); - - connect(dm, SIGNAL(debuggingFinished()), - this, SLOT(debuggingFinished()), Qt::QueuedConnection); - connect(dm, SIGNAL(applicationOutputAvailable(QString, bool)), - this, SLOT(printApplicationOutput(QString, bool)), - Qt::QueuedConnection); + QTC_ASSERT(rc, return); m_startParams->remoteChannel = rc->serialPortName(); m_startParams->processArgs = rc->commandLineArguments(); @@ -913,19 +906,17 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *ru } } -void S60DeviceDebugRunControl::stop() +S60DeviceDebugRunControl::~S60DeviceDebugRunControl() { - S60DeviceRunControlBase::stop(); - Debugger::DebuggerPlugin *dm = Debugger::DebuggerPlugin::instance(); - QTC_ASSERT(dm, return) - // FIXME: ABC: that should use the RunControl present in - // handleLauncherFinished - if (dm->state() == Debugger::DebuggerNotReady) - dm->exitDebugger(); + // FIXME: Needed? m_debuggerRunControl->deleteLater(); } -S60DeviceDebugRunControl::~S60DeviceDebugRunControl() +void S60DeviceDebugRunControl::stop() { + S60DeviceRunControlBase::stop(); + QTC_ASSERT(m_debuggerRunControl, return) + if (m_debuggerRunControl->state() == Debugger::DebuggerNotReady) + m_debuggerRunControl->stop(); } void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Launcher *launcher) @@ -949,9 +940,18 @@ void S60DeviceDebugRunControl::handleLauncherFinished() { using namespace Debugger; emit appendMessage(this, tr("Launching debugger..."), false); - ProjectExplorer::RunControl *rc - = DebuggerPlugin::createDebugger(*m_startParams.data()); - DebuggerPlugin::startDebugger(rc); + QTC_ASSERT(m_debuggerRunControl == 0, /* Should happen only once. */); + m_debuggerRunControl = DebuggerPlugin::createDebugger(*m_startParams.data()); + connect(m_debuggerRunControl, + SIGNAL(finished()), + SLOT(debuggingFinished()), + Qt::QueuedConnection); + connect(m_debuggerRunControl, + SIGNAL(addToOutputWindowInline(ProjectExplorer::RunControl,QString,bool)), + SIGNAL(addToOutputWindowInline(ProjectExplorer::RunControl,QString,bool)), + Qt::QueuedConnection); + + DebuggerPlugin::startDebugger(m_debuggerRunControl); } void S60DeviceDebugRunControl::debuggingFinished() diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index f37e67e99c9e6f72f32dfe3e2681a82efbceee62..a1cb5d45906c68ad1e28c747e4322c6c8654a2cd 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -45,6 +45,7 @@ QT_END_NAMESPACE namespace Debugger { class DebuggerStartParameters; +class DebuggerRunControl; } namespace SymbianUtils { @@ -245,6 +246,7 @@ private slots: void debuggingFinished(); private: QSharedPointer<Debugger::DebuggerStartParameters> m_startParams; + Debugger::DebuggerRunControl *m_debuggerRunControl; QString m_localExecutableFileName; };