debugger: start 'runcontrol-ification' of the debugger plugin.

This replaces most uses of DebuggerStartParameters by DebuggerRunControl
which is a simple RunControl with a DebuggerStartParameters member.

Plan is to move all global state to the run controls, and possibly
introduce specialized ones for core debugging etc.
This commit is contained in:
hjk
2010-06-14 08:57:15 +02:00
parent a89643a833
commit 97edcb7977
25 changed files with 164 additions and 154 deletions

View File

@@ -386,8 +386,9 @@ void CdbDebugEngine::startupChecks()
syncDebuggerPaths(); syncDebuggerPaths();
} }
void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) void CdbDebugEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
DebuggerStartParameters *sp = &runControl->sp();
if (debugCDBExecution) if (debugCDBExecution)
qDebug() << "startDebugger" << *sp; qDebug() << "startDebugger" << *sp;
CdbCore::BreakPoint::clearNormalizeFileNameCache(); CdbCore::BreakPoint::clearNormalizeFileNameCache();

View File

@@ -63,7 +63,7 @@ public:
virtual void shutdown(); virtual void shutdown();
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
virtual void startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters); virtual void startDebugger(const DebuggerRunControl *runControl);
virtual void exitDebugger(); virtual void exitDebugger();
virtual void detachDebugger(); virtual void detachDebugger();
virtual void updateWatchData(const WatchData &data); virtual void updateWatchData(const WatchData &data);

View File

@@ -269,7 +269,7 @@ struct DebuggerManagerPrivate
const QIcon m_locationMarkIcon; const QIcon m_locationMarkIcon;
// FIXME: Remove engine-specific state // FIXME: Remove engine-specific state
DebuggerStartParametersPtr m_startParameters; const DebuggerRunControl *m_runControl;
qint64 m_inferiorPid; qint64 m_inferiorPid;
/// Views /// Views
@@ -328,7 +328,6 @@ DebuggerManagerPrivate::DebuggerManagerPrivate(DebuggerManager *manager) :
m_stopIcon(QLatin1String(":/debugger/images/debugger_stop_small.png")), m_stopIcon(QLatin1String(":/debugger/images/debugger_stop_small.png")),
m_interruptIcon(QLatin1String(":/debugger/images/debugger_interrupt_small.png")), m_interruptIcon(QLatin1String(":/debugger/images/debugger_interrupt_small.png")),
m_locationMarkIcon(QLatin1String(":/debugger/images/location_16.png")), m_locationMarkIcon(QLatin1String(":/debugger/images/location_16.png")),
m_startParameters(new DebuggerStartParameters),
m_inferiorPid(0), m_inferiorPid(0),
m_disassemblerViewAgent(manager), m_disassemblerViewAgent(manager),
m_engine(0) m_engine(0)
@@ -1061,11 +1060,12 @@ static IDebuggerEngine *debuggerEngineForMode(DebuggerStartMode startMode, QStri
#endif #endif
} }
void DebuggerManager::startNewDebugger(const DebuggerStartParametersPtr &sp) void DebuggerManager::startNewDebugger(const DebuggerRunControl *runControl)
{ {
if (d->m_state != DebuggerNotReady) if (d->m_state != DebuggerNotReady)
return; return;
d->m_startParameters = sp; d->m_runControl = runControl;
const DebuggerStartParameters *sp = &runControl->sp();
d->m_inferiorPid = sp->attachPID > 0 ? sp->attachPID : 0; d->m_inferiorPid = sp->attachPID > 0 ? sp->attachPID : 0;
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName( const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(
ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType)); ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType));
@@ -1113,7 +1113,7 @@ void DebuggerManager::startNewDebugger(const DebuggerStartParametersPtr &sp)
setBusyCursor(false); setBusyCursor(false);
setState(EngineStarting); setState(EngineStarting);
connect(d->m_engine, SIGNAL(startFailed()), this, SLOT(startFailed())); connect(d->m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
d->m_engine->startDebugger(sp); d->m_engine->startDebugger(runControl);
const unsigned engineCapabilities = d->m_engine->debuggerCapabilities(); const unsigned engineCapabilities = d->m_engine->debuggerCapabilities();
theDebuggerAction(OperateByInstruction) theDebuggerAction(OperateByInstruction)
@@ -1174,11 +1174,6 @@ void DebuggerManager::abortDebugger()
d->m_codeModelSnapshot = CPlusPlus::Snapshot(); d->m_codeModelSnapshot = CPlusPlus::Snapshot();
} }
DebuggerStartParametersPtr DebuggerManager::startParameters() const
{
return d->m_startParameters;
}
qint64 DebuggerManager::inferiorPid() const qint64 DebuggerManager::inferiorPid() const
{ {
return d->m_inferiorPid; return d->m_inferiorPid;
@@ -1316,7 +1311,7 @@ void DebuggerManager::aboutToUnloadSession()
// Note that at startup, session switches may occur, which interfer // Note that at startup, session switches may occur, which interfer
// with command-line debugging startup. // with command-line debugging startup.
if (d->m_engine && state() != DebuggerNotReady if (d->m_engine && state() != DebuggerNotReady
&& d->m_startParameters->startMode == StartInternal) && runControl()->sp().startMode == StartInternal)
d->m_engine->shutdown(); d->m_engine->shutdown();
} }
@@ -1651,7 +1646,7 @@ QString DebuggerManager::qtDumperLibraryName() const
{ {
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())
return theDebuggerAction(CustomDebuggingHelperLocation)->value().toString(); return theDebuggerAction(CustomDebuggingHelperLocation)->value().toString();
return d->m_startParameters->dumperLibrary; return runControl()->sp().dumperLibrary;
} }
QStringList DebuggerManager::qtDumperLibraryLocations() const QStringList DebuggerManager::qtDumperLibraryLocations() const
@@ -1663,7 +1658,7 @@ QStringList DebuggerManager::qtDumperLibraryLocations() const
tr("%1 (explicitly set in the Debugger Options)").arg(customLocation); tr("%1 (explicitly set in the Debugger Options)").arg(customLocation);
return QStringList(location); return QStringList(location);
} }
return d->m_startParameters->dumperLibraryLocations; return runControl()->sp().dumperLibraryLocations;
} }
void DebuggerManager::showQtDumperLibraryWarning(const QString &details) void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
@@ -2033,6 +2028,11 @@ void DebuggerManager::openTextEditor(const QString &titlePattern,
d->m_plugin->openTextEditor(titlePattern, contents); d->m_plugin->openTextEditor(titlePattern, contents);
} }
DebuggerRunControl *DebuggerManager::runControl() const
{
return const_cast<DebuggerRunControl *>(d->m_runControl);
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// AbstractDebuggerEngine // AbstractDebuggerEngine
@@ -2060,6 +2060,7 @@ void IDebuggerEngine::setState(DebuggerState state, bool forced)
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/*
void DebuggerManager::runTest(const QString &fileName) void DebuggerManager::runTest(const QString &fileName)
{ {
d->m_startParameters->executable = fileName; d->m_startParameters->executable = fileName;
@@ -2067,6 +2068,7 @@ void DebuggerManager::runTest(const QString &fileName)
d->m_startParameters->workingDirectory.clear(); d->m_startParameters->workingDirectory.clear();
//startNewDebugger(StartInternal); //startNewDebugger(StartInternal);
} }
*/
} // namespace Debugger } // namespace Debugger

View File

@@ -156,7 +156,7 @@ public:
QLabel *statusLabel() const; QLabel *statusLabel() const;
Internal::IDebuggerEngine *currentEngine() const; Internal::IDebuggerEngine *currentEngine() const;
DebuggerStartParametersPtr startParameters() const; DebuggerRunControl *runControl() const;
qint64 inferiorPid() const; qint64 inferiorPid() const;
QMessageBox *showMessageBox(int icon, const QString &title, const QString &text, QMessageBox *showMessageBox(int icon, const QString &title, const QString &text,
@@ -177,7 +177,7 @@ public:
static DebuggerManager *instance(); static DebuggerManager *instance();
public slots: public slots:
void startNewDebugger(const DebuggerStartParametersPtr &sp); void startNewDebugger(const DebuggerRunControl *runControl);
void exitDebugger(); void exitDebugger();
void abortDebugger(); void abortDebugger();

View File

@@ -1369,7 +1369,7 @@ void DebuggerPlugin::handleStateChanged(int state)
//const bool running = state == InferiorRunning; //const bool running = state == InferiorRunning;
const bool detachable = state == InferiorStopped const bool detachable = state == InferiorStopped
&& m_manager->startParameters()->startMode != AttachCore; && m_manager->runControl()->sp().startMode != AttachCore;
m_startExternalAction->setEnabled(!started && !starting); m_startExternalAction->setEnabled(!started && !starting);
m_attachExternalAction->setEnabled(!started && !starting); m_attachExternalAction->setEnabled(!started && !starting);
@@ -1445,7 +1445,7 @@ void DebuggerPlugin::showSettingsDialog()
void DebuggerPlugin::startExternalApplication() void DebuggerPlugin::startExternalApplication()
{ {
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); DebuggerStartParameters sp;
StartExternalDialog dlg(m_uiSwitcher->mainWindow()); StartExternalDialog dlg(m_uiSwitcher->mainWindow());
dlg.setExecutableFile( dlg.setExecutableFile(
configValue(_("LastExternalExecutableFile")).toString()); configValue(_("LastExternalExecutableFile")).toString());
@@ -1462,11 +1462,11 @@ void DebuggerPlugin::startExternalApplication()
dlg.executableArguments()); dlg.executableArguments());
setConfigValue(_("LastExternalWorkingDirectory"), setConfigValue(_("LastExternalWorkingDirectory"),
dlg.workingDirectory()); dlg.workingDirectory());
sp->executable = dlg.executableFile(); sp.executable = dlg.executableFile();
sp->startMode = StartExternal; sp.startMode = StartExternal;
sp->workingDirectory = dlg.workingDirectory(); sp.workingDirectory = dlg.workingDirectory();
if (!dlg.executableArguments().isEmpty()) if (!dlg.executableArguments().isEmpty())
sp->processArgs = dlg.executableArguments().split(QLatin1Char(' ')); sp.processArgs = dlg.executableArguments().split(QLatin1Char(' '));
if (dlg.breakAtMain()) if (dlg.breakAtMain())
m_manager->breakByFunctionMain(); m_manager->breakByFunctionMain();
@@ -1491,11 +1491,11 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid,
tr("Cannot attach to PID 0")); tr("Cannot attach to PID 0"));
return; return;
} }
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); DebuggerStartParameters sp;
sp->attachPID = pid; sp.attachPID = pid;
sp->executable = binary; sp.executable = binary;
sp->crashParameter = crashParameter; sp.crashParameter = crashParameter;
sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal; sp.startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()->startRunControl(runControl, PE::DEBUGMODE); ProjectExplorerPlugin::instance()->startRunControl(runControl, PE::DEBUGMODE);
} }
@@ -1518,11 +1518,11 @@ void DebuggerPlugin::attachCore()
void DebuggerPlugin::attachCore(const QString &core, const QString &exe) void DebuggerPlugin::attachCore(const QString &core, const QString &exe)
{ {
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); DebuggerStartParameters sp;
sp->executable = exe; sp.executable = exe;
sp->coreFile = core; sp.coreFile = core;
sp->displayName = tr("Core file: \"%1\"").arg(core); sp.displayName = tr("Core file: \"%1\"").arg(core);
sp->startMode = AttachCore; sp.startMode = AttachCore;
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()-> ProjectExplorerPlugin::instance()->
startRunControl(runControl, PE::DEBUGMODE); startRunControl(runControl, PE::DEBUGMODE);
@@ -1530,7 +1530,7 @@ void DebuggerPlugin::attachCore(const QString &core, const QString &exe)
void DebuggerPlugin::startRemoteApplication() void DebuggerPlugin::startRemoteApplication()
{ {
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); DebuggerStartParameters sp;
StartRemoteDialog dlg(m_uiSwitcher->mainWindow()); StartRemoteDialog dlg(m_uiSwitcher->mainWindow());
QStringList arches; QStringList arches;
arches.append(_("i386:x86-64:intel")); arches.append(_("i386:x86-64:intel"));
@@ -1559,17 +1559,17 @@ void DebuggerPlugin::startRemoteApplication()
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript()); setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript()); setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
setConfigValue(_("LastSysroot"), dlg.sysRoot()); setConfigValue(_("LastSysroot"), dlg.sysRoot());
sp->remoteChannel = dlg.remoteChannel(); sp.remoteChannel = dlg.remoteChannel();
sp->remoteArchitecture = dlg.remoteArchitecture(); sp.remoteArchitecture = dlg.remoteArchitecture();
sp->executable = dlg.localExecutable(); sp.executable = dlg.localExecutable();
sp->displayName = dlg.localExecutable(); sp.displayName = dlg.localExecutable();
sp->debuggerCommand = dlg.debugger(); // Override toolchain-detection. sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
if (!sp->debuggerCommand.isEmpty()) if (!sp.debuggerCommand.isEmpty())
sp->toolChainType = ProjectExplorer::ToolChain::INVALID; sp.toolChainType = ProjectExplorer::ToolChain::INVALID;
sp->startMode = AttachToRemote; sp.startMode = AttachToRemote;
if (dlg.useServerStartScript()) if (dlg.useServerStartScript())
sp->serverStartScript = dlg.serverStartScript(); sp.serverStartScript = dlg.serverStartScript();
sp->sysRoot = dlg.sysRoot(); sp.sysRoot = dlg.sysRoot();
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance() ProjectExplorerPlugin::instance()
@@ -1586,7 +1586,7 @@ void DebuggerPlugin::enableReverseDebuggingTriggered(const QVariant &value)
void DebuggerPlugin::attachRemoteTcf() void DebuggerPlugin::attachRemoteTcf()
{ {
const DebuggerStartParametersPtr sp(new DebuggerStartParameters); DebuggerStartParameters sp;
AttachTcfDialog dlg(m_uiSwitcher->mainWindow()); AttachTcfDialog dlg(m_uiSwitcher->mainWindow());
QStringList arches; QStringList arches;
arches.append(_("i386:x86-64:intel")); arches.append(_("i386:x86-64:intel"));
@@ -1605,12 +1605,12 @@ void DebuggerPlugin::attachRemoteTcf()
setConfigValue(_("LastTcfRemoteArchitecture"), dlg.remoteArchitecture()); setConfigValue(_("LastTcfRemoteArchitecture"), dlg.remoteArchitecture());
setConfigValue(_("LastTcfServerStartScript"), dlg.serverStartScript()); setConfigValue(_("LastTcfServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastTcfUseServerStartScript"), dlg.useServerStartScript()); setConfigValue(_("LastTcfUseServerStartScript"), dlg.useServerStartScript());
sp->remoteChannel = dlg.remoteChannel(); sp.remoteChannel = dlg.remoteChannel();
sp->remoteArchitecture = dlg.remoteArchitecture(); sp.remoteArchitecture = dlg.remoteArchitecture();
sp->serverStartScript = dlg.serverStartScript(); sp.serverStartScript = dlg.serverStartScript();
sp->startMode = AttachTcf; sp.startMode = AttachTcf;
if (dlg.useServerStartScript()) if (dlg.useServerStartScript())
sp->serverStartScript = dlg.serverStartScript(); sp.serverStartScript = dlg.serverStartScript();
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance() ProjectExplorerPlugin::instance()

View File

@@ -57,11 +57,11 @@ namespace Debugger {
class DebuggerManager; class DebuggerManager;
class DebuggerUISwitcher; class DebuggerUISwitcher;
class DebuggerRunControlFactory;
namespace Internal { namespace Internal {
class BreakpointData; class BreakpointData;
class DebuggerRunControlFactory;
class DebugMode; class DebugMode;
class DebuggerPlugin : public ExtensionSystem::IPlugin class DebuggerPlugin : public ExtensionSystem::IPlugin

View File

@@ -50,7 +50,6 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace Debugger { namespace Debugger {
namespace Internal {
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// //
@@ -75,24 +74,24 @@ QString DebuggerRunControlFactory::displayName() const
return tr("Debug"); return tr("Debug");
} }
static DebuggerStartParametersPtr localStartParameters(RunConfiguration *runConfiguration) static DebuggerStartParameters localStartParameters(RunConfiguration *runConfiguration)
{ {
DebuggerStartParametersPtr sp(new DebuggerStartParameters()); DebuggerStartParameters sp;
QTC_ASSERT(runConfiguration, return sp); QTC_ASSERT(runConfiguration, return sp);
LocalApplicationRunConfiguration *rc = LocalApplicationRunConfiguration *rc =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc, return sp); QTC_ASSERT(rc, return sp);
sp->startMode = StartInternal; sp.startMode = StartInternal;
sp->executable = rc->executable(); sp.executable = rc->executable();
sp->environment = rc->environment().toStringList(); sp.environment = rc->environment().toStringList();
sp->workingDirectory = rc->workingDirectory(); sp.workingDirectory = rc->workingDirectory();
sp->processArgs = rc->commandLineArguments(); sp.processArgs = rc->commandLineArguments();
sp->toolChainType = rc->toolChainType(); sp.toolChainType = rc->toolChainType();
sp->useTerminal = rc->runMode() == LocalApplicationRunConfiguration::Console; sp.useTerminal = rc->runMode() == LocalApplicationRunConfiguration::Console;
sp->dumperLibrary = rc->dumperLibrary(); sp.dumperLibrary = rc->dumperLibrary();
sp->dumperLibraryLocations = rc->dumperLibraryLocations(); sp.dumperLibraryLocations = rc->dumperLibraryLocations();
sp->displayName = rc->displayName(); sp.displayName = rc->displayName();
// Find qtInstallPath. // Find qtInstallPath.
QString qmakePath = DebuggingHelperLibrary::findSystemQt(rc->environment()); QString qmakePath = DebuggingHelperLibrary::findSystemQt(rc->environment());
@@ -105,7 +104,7 @@ static DebuggerStartParametersPtr localStartParameters(RunConfiguration *runConf
proc.waitForFinished(); proc.waitForFinished();
QByteArray ba = proc.readAllStandardOutput().trimmed(); QByteArray ba = proc.readAllStandardOutput().trimmed();
QFileInfo fi(QString::fromLocal8Bit(ba) + "/.."); QFileInfo fi(QString::fromLocal8Bit(ba) + "/..");
sp->qtInstallPath = fi.absoluteFilePath(); sp.qtInstallPath = fi.absoluteFilePath();
} }
return sp; return sp;
} }
@@ -114,11 +113,11 @@ RunControl *DebuggerRunControlFactory::create(RunConfiguration *runConfiguration
const QString &mode) const QString &mode)
{ {
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0); QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
DebuggerStartParametersPtr sp = localStartParameters(runConfiguration); DebuggerStartParameters sp = localStartParameters(runConfiguration);
return new DebuggerRunControl(m_manager, sp); return new DebuggerRunControl(m_manager, sp);
} }
RunControl *DebuggerRunControlFactory::create(const DebuggerStartParametersPtr &sp) RunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp)
{ {
return new DebuggerRunControl(m_manager, sp); return new DebuggerRunControl(m_manager, sp);
} }
@@ -139,7 +138,7 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
const DebuggerStartParametersPtr &startParameters) const DebuggerStartParameters &startParameters)
: RunControl(0, ProjectExplorer::Constants::DEBUGMODE), : RunControl(0, ProjectExplorer::Constants::DEBUGMODE),
m_startParameters(startParameters), m_startParameters(startParameters),
m_manager(manager), m_manager(manager),
@@ -159,19 +158,19 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
connect(this, SIGNAL(stopRequested()), connect(this, SIGNAL(stopRequested()),
m_manager, SLOT(exitDebugger())); m_manager, SLOT(exitDebugger()));
if (m_startParameters->environment.empty()) if (m_startParameters.environment.empty())
m_startParameters->environment = ProjectExplorer::Environment().toStringList(); m_startParameters.environment = ProjectExplorer::Environment().toStringList();
m_startParameters->useTerminal = false; m_startParameters.useTerminal = false;
} }
QString DebuggerRunControl::displayName() const QString DebuggerRunControl::displayName() const
{ {
return m_startParameters->displayName; return m_startParameters.displayName;
} }
void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env) void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env)
{ {
m_startParameters->environment = env.toStringList(); m_startParameters.environment = env.toStringList();
} }
void DebuggerRunControl::init() void DebuggerRunControl::init()
@@ -184,9 +183,9 @@ void DebuggerRunControl::start()
QString errorMessage; QString errorMessage;
QString settingsCategory; QString settingsCategory;
QString settingsPage; QString settingsPage;
if (m_manager->checkDebugConfiguration(m_startParameters->toolChainType, &errorMessage, if (m_manager->checkDebugConfiguration(m_startParameters.toolChainType, &errorMessage,
&settingsCategory, &settingsPage)) { &settingsCategory, &settingsPage)) {
m_manager->startNewDebugger(m_startParameters); m_manager->startNewDebugger(this);
emit started(); emit started();
} else { } else {
appendMessage(this, errorMessage, true); appendMessage(this, errorMessage, true);
@@ -225,5 +224,4 @@ bool DebuggerRunControl::isRunning() const
return m_running; return m_running;
} }
} // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -78,12 +78,8 @@ public:
DebuggerStartMode startMode; DebuggerStartMode startMode;
}; };
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
//DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &); //DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);
namespace Internal {
class DEBUGGER_EXPORT DebuggerRunControlFactory class DEBUGGER_EXPORT DebuggerRunControlFactory
: public ProjectExplorer::IRunControlFactory : public ProjectExplorer::IRunControlFactory
{ {
@@ -102,7 +98,7 @@ public:
// This is used by the "Non-Standard" scenarios, e.g. Attach to Core. // This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
ProjectExplorer::RunControl *create(const DebuggerStartParametersPtr &sp); ProjectExplorer::RunControl *create(const DebuggerStartParameters &sp);
private: private:
DebuggerManager *m_manager; DebuggerManager *m_manager;
@@ -116,7 +112,7 @@ class DEBUGGER_EXPORT DebuggerRunControl
public: public:
DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl(DebuggerManager *manager,
const DebuggerStartParametersPtr &startParameters); const DebuggerStartParameters &startParameters);
void setCustomEnvironment(ProjectExplorer::Environment env); void setCustomEnvironment(ProjectExplorer::Environment env);
@@ -128,6 +124,8 @@ public:
Q_SLOT void debuggingFinished(); Q_SLOT void debuggingFinished();
const DebuggerStartParameters &sp() const { return m_startParameters; }
signals: signals:
void stopRequested(); void stopRequested();
@@ -137,12 +135,11 @@ private slots:
private: private:
void init(); void init();
DebuggerStartParametersPtr m_startParameters;
DebuggerManager *m_manager; DebuggerManager *m_manager;
DebuggerStartParameters m_startParameters;
bool m_running; bool m_running;
}; };
} // namespace Internal
} // namespace Debugger } // namespace Debugger
#endif // DEBUGGERRUNNER_H #endif // DEBUGGERRUNNER_H

View File

@@ -107,6 +107,8 @@ protected:
{ m_engine->setState(state); } { m_engine->setState(state); }
const DebuggerStartParameters &startParameters() const const DebuggerStartParameters &startParameters() const
{ return m_engine->startParameters(); } { return m_engine->startParameters(); }
const DebuggerRunControl *runControl() const
{ return m_engine->runControl(); }
void debugMessage(const QString &msg) const void debugMessage(const QString &msg) const
{ m_engine->debugMessage(msg); } { m_engine->debugMessage(msg); }
void showStatusMessage(const QString &msg) const void showStatusMessage(const QString &msg) const

View File

@@ -514,9 +514,9 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
QByteArray dlopenLib; QByteArray dlopenLib;
if (startParameters().startMode == AttachToRemote if (runControl()->sp().startMode == AttachToRemote
|| startParameters().startMode == StartRemoteGdb) || runControl()->sp().startMode == StartRemoteGdb)
dlopenLib = startParameters().remoteDumperLib; dlopenLib = runControl()->sp().remoteDumperLib;
else else
dlopenLib = manager()->qtDumperLibraryName().toLocal8Bit(); dlopenLib = manager()->qtDumperLibraryName().toLocal8Bit();

View File

@@ -211,8 +211,8 @@ void GdbEngine::disconnectDebuggingHelperActions()
DebuggerStartMode GdbEngine::startMode() const DebuggerStartMode GdbEngine::startMode() const
{ {
QTC_ASSERT(!m_startParameters.isNull(), return NoStartMode); QTC_ASSERT(m_runControl, return NoStartMode);
return m_startParameters->startMode; return startParameters().startMode;
} }
QMainWindow *GdbEngine::mainWindow() const QMainWindow *GdbEngine::mainWindow() const
@@ -1355,7 +1355,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
&& reason == "signal-received") { && reason == "signal-received") {
QByteArray name = data.findChild("signal-name").data(); QByteArray name = data.findChild("signal-name").data();
if (name != STOP_SIGNAL if (name != STOP_SIGNAL
&& (startParameters().startMode != AttachToRemote && (runControl()->sp().startMode != AttachToRemote
|| name != CROSS_STOP_SIGNAL)) || name != CROSS_STOP_SIGNAL))
initHelpers = false; initHelpers = false;
} }
@@ -1434,7 +1434,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
// Ignore these as they are showing up regularly when // Ignore these as they are showing up regularly when
// stopping debugging. // stopping debugging.
if (name != STOP_SIGNAL if (name != STOP_SIGNAL
&& (startParameters().startMode != AttachToRemote && (runControl()->sp().startMode != AttachToRemote
|| name != CROSS_STOP_SIGNAL)) { || name != CROSS_STOP_SIGNAL)) {
QString msg = tr("<p>The inferior stopped because it received a " QString msg = tr("<p>The inferior stopped because it received a "
"signal from the Operating System.<p>" "signal from the Operating System.<p>"
@@ -1536,8 +1536,8 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
QByteArray cmd = "set environment "; QByteArray cmd = "set environment ";
cmd += Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR; cmd += Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR;
cmd += ' '; cmd += ' ';
cmd += startParameters().startMode == StartRemoteGdb cmd += runControl()->sp().startMode == StartRemoteGdb
? startParameters().remoteDumperLib ? runControl()->sp().remoteDumperLib
: cmd += manager()->qtDumperLibraryName().toLocal8Bit(); : cmd += manager()->qtDumperLibraryName().toLocal8Bit();
postCommand(cmd); postCommand(cmd);
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
@@ -1737,8 +1737,9 @@ bool GdbEngine::checkConfiguration(int toolChain, QString *errorMessage, QString
return true; return true;
} }
AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerStartParametersPtr &sp) AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerRunControl *runControl)
{ {
const DebuggerStartParameters *sp = &runControl->sp();
switch (sp->toolChainType) { switch (sp->toolChainType) {
case ProjectExplorer::ToolChain::WINSCW: // S60 case ProjectExplorer::ToolChain::WINSCW: // S60
case ProjectExplorer::ToolChain::GCCE: case ProjectExplorer::ToolChain::GCCE:
@@ -1769,7 +1770,7 @@ AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerStartParametersPtr &s
} }
} }
void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) void GdbEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
// This should be set by the constructor or in exitDebugger() // This should be set by the constructor or in exitDebugger()
@@ -1787,10 +1788,10 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
fp->setKeepOnFinish(false); fp->setKeepOnFinish(false);
m_progress->reportStarted(); m_progress->reportStarted();
m_startParameters = sp; m_runControl = runControl;
delete m_gdbAdapter; delete m_gdbAdapter;
m_gdbAdapter = createAdapter(sp); m_gdbAdapter = createAdapter(m_runControl);
connectAdapter(); connectAdapter();
if (m_gdbAdapter->dumperHandling() != AbstractGdbAdapter::DumperNotAvailable) if (m_gdbAdapter->dumperHandling() != AbstractGdbAdapter::DumperNotAvailable)
@@ -3036,8 +3037,10 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
void GdbEngine::activateSnapshot(int index) void GdbEngine::activateSnapshot(int index)
{ {
SnapshotData snapshot = m_manager->snapshotHandler()->setCurrentIndex(index); SnapshotData snapshot = m_manager->snapshotHandler()->setCurrentIndex(index);
m_startParameters->startMode = AttachCore;
m_startParameters->coreFile = snapshot.location(); DebuggerStartParameters &sp = const_cast<DebuggerStartParameters &>(m_runControl->sp());
sp.startMode = AttachCore;
sp.coreFile = snapshot.location();
if (state() == InferiorUnrunnable) { if (state() == InferiorUnrunnable) {
// All is well. We are looking at another core file. // All is well. We are looking at another core file.
@@ -3055,7 +3058,7 @@ void GdbEngine::activateSnapshot(int index)
return; return;
debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER")); debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
delete m_gdbAdapter; delete m_gdbAdapter;
m_gdbAdapter = createAdapter(m_startParameters); m_gdbAdapter = createAdapter(m_runControl);
postCommand("kill", NeedsStop, CB(handleActivateSnapshot)); postCommand("kill", NeedsStop, CB(handleActivateSnapshot));
} else { } else {
activateSnapshot2(); activateSnapshot2();
@@ -4002,11 +4005,11 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
m_gdb = QString::fromLatin1(qgetenv("QTC_DEBUGGER_PATH")); m_gdb = QString::fromLatin1(qgetenv("QTC_DEBUGGER_PATH"));
if (m_gdb.isEmpty()) if (m_gdb.isEmpty())
m_gdb = m_gdbBinaryToolChainMap->key(m_startParameters->toolChainType); m_gdb = m_gdbBinaryToolChainMap->key(m_runControl->sp().toolChainType);
if (m_gdb.isEmpty()) if (m_gdb.isEmpty())
m_gdb = gdb; m_gdb = gdb;
if (m_gdb.isEmpty()) { if (m_gdb.isEmpty()) {
handleAdapterStartFailed(msgNoBinaryForToolChain(m_startParameters->toolChainType), handleAdapterStartFailed(msgNoBinaryForToolChain(m_runControl->sp().toolChainType),
GdbOptionsPage::settingsId()); GdbOptionsPage::settingsId());
return false; return false;
} }
@@ -4241,7 +4244,7 @@ void GdbEngine::handleAdapterStarted()
void GdbEngine::handleInferiorPrepared() void GdbEngine::handleInferiorPrepared()
{ {
const QByteArray qtInstallPath = m_startParameters->qtInstallPath.toLocal8Bit(); const QByteArray qtInstallPath = m_runControl->sp().qtInstallPath.toLocal8Bit();
if (!qtInstallPath.isEmpty()) { if (!qtInstallPath.isEmpty()) {
QByteArray qtBuildPath; QByteArray qtBuildPath;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View File

@@ -111,7 +111,7 @@ private: ////////// General Interface //////////
virtual bool checkConfiguration(int toolChain, QString *errorMessage, virtual bool checkConfiguration(int toolChain, QString *errorMessage,
QString *settingsPage = 0) const; QString *settingsPage = 0) const;
virtual void startDebugger(const DebuggerStartParametersPtr &sp); virtual void startDebugger(const DebuggerRunControl *runControl);
virtual unsigned debuggerCapabilities() const; virtual unsigned debuggerCapabilities() const;
virtual void exitDebugger(); virtual void exitDebugger();
virtual void abortDebugger(); virtual void abortDebugger();
@@ -125,16 +125,16 @@ private: ////////// General State //////////
void initializeVariables(); void initializeVariables();
DebuggerStartMode startMode() const; DebuggerStartMode startMode() const;
const DebuggerStartParameters &startParameters() const const DebuggerRunControl *runControl() const { return m_runControl; }
{ return *m_startParameters; } const DebuggerStartParameters &startParameters() const { return m_runControl->sp(); }
Q_SLOT void setAutoDerefPointers(const QVariant &on); Q_SLOT void setAutoDerefPointers(const QVariant &on);
DebuggerStartParametersPtr m_startParameters; const DebuggerRunControl *m_runControl;
bool m_registerNamesListed; bool m_registerNamesListed;
private: ////////// Gdb Process Management ////////// private: ////////// Gdb Process Management //////////
AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp); AbstractGdbAdapter *createAdapter(const DebuggerRunControl *runControl);
void connectAdapter(); void connectAdapter();
bool startGdb(const QStringList &args = QStringList(), bool startGdb(const QStringList &args = QStringList(),
const QString &gdb = QString(), const QString &gdb = QString(),

View File

@@ -50,8 +50,10 @@ class IOptionsPage;
} }
namespace Debugger { namespace Debugger {
class DebuggerManager; class DebuggerManager;
class DebuggerStartParameters; class DebuggerRunControl;
namespace Internal { namespace Internal {
class DisassemblerViewAgent; class DisassemblerViewAgent;
@@ -64,15 +66,13 @@ class IDebuggerEngine : public QObject
Q_OBJECT Q_OBJECT
public: public:
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0) IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0)
: QObject(parent), m_manager(manager) : QObject(parent), m_manager(manager)
{} {}
virtual void shutdown() = 0; virtual void shutdown() = 0;
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0; virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0;
virtual void startDebugger(const DebuggerStartParametersPtr &startParameters) = 0; virtual void startDebugger(const DebuggerRunControl *runControl) = 0;
virtual void exitDebugger() = 0; virtual void exitDebugger() = 0;
virtual void abortDebugger() { exitDebugger(); } virtual void abortDebugger() { exitDebugger(); }
virtual void detachDebugger() {} virtual void detachDebugger() {}

View File

@@ -136,11 +136,11 @@ void PdbEngine::exitDebugger()
setState(DebuggerNotReady); setState(DebuggerNotReady);
} }
void PdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) void PdbEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
setState(AdapterStarting); setState(AdapterStarting);
m_scriptFileName = QFileInfo(sp->executable).absoluteFilePath(); m_scriptFileName = QFileInfo(runControl->sp().executable).absoluteFilePath();
QFile scriptFile(m_scriptFileName); QFile scriptFile(m_scriptFileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
//debugMessage("STARTING " +m_scriptFileName + "FAILED"); //debugMessage("STARTING " +m_scriptFileName + "FAILED");

View File

@@ -72,7 +72,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, int cursorPos); TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp); void startDebugger(const DebuggerRunControl *runControl);
void exitDebugger(); void exitDebugger();

View File

@@ -201,14 +201,14 @@ void QmlEngine::exitDebugger()
manager()->notifyInferiorExited(); manager()->notifyInferiorExited();
} }
void QmlEngine::startDebugger(const DebuggerStartParametersPtr &sp) void QmlEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
qDebug() << "STARTING QML ENGINE"; qDebug() << "STARTING QML ENGINE";
setState(InferiorRunningRequested); setState(InferiorRunningRequested);
showStatusMessage(tr("Running requested..."), 5000); showStatusMessage(tr("Running requested..."), 5000);
const int pos = sp->remoteChannel.indexOf(QLatin1Char(':')); const int pos = runControl->sp().remoteChannel.indexOf(QLatin1Char(':'));
const QString host = sp->remoteChannel.left(pos); const QString host = runControl->sp().remoteChannel.left(pos);
const quint16 port = sp->remoteChannel.mid(pos + 1).toInt(); const quint16 port = runControl->sp().remoteChannel.mid(pos + 1).toInt();
//QTimer::singleShot(0, this, SLOT(runInferior())); //QTimer::singleShot(0, this, SLOT(runInferior()));
m_socket->connectToHost(host, port); m_socket->connectToHost(host, port);
emit startSuccessful(); emit startSuccessful();

View File

@@ -75,7 +75,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp); void startDebugger(const DebuggerRunControl *runControl);
void exitDebugger(); void exitDebugger();
void continueInferior(); void continueInferior();

View File

@@ -228,7 +228,7 @@ void ScriptEngine::exitDebugger()
setState(DebuggerNotReady); setState(DebuggerNotReady);
} }
void ScriptEngine::startDebugger(const DebuggerStartParametersPtr &sp) void ScriptEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
setState(AdapterStarting); setState(AdapterStarting);
if (m_scriptEngine.isNull()) if (m_scriptEngine.isNull())
@@ -247,7 +247,7 @@ void ScriptEngine::startDebugger(const DebuggerStartParametersPtr &sp)
setState(AdapterStarted); setState(AdapterStarted);
setState(InferiorStarting); setState(InferiorStarting);
m_scriptFileName = QFileInfo (sp->executable).absoluteFilePath(); m_scriptFileName = QFileInfo(runControl->sp().executable).absoluteFilePath();
QFile scriptFile(m_scriptFileName); QFile scriptFile(m_scriptFileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
manager()->showDebuggerOutput(LogError, QString::fromLatin1("Cannot open %1: %2"). manager()->showDebuggerOutput(LogError, QString::fromLatin1("Cannot open %1: %2").

View File

@@ -71,7 +71,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, int cursorPos); TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp); void startDebugger(const DebuggerRunControl *runControl);
void exitDebugger(); void exitDebugger();

View File

@@ -203,13 +203,13 @@ void TcfEngine::exitDebugger()
manager()->notifyInferiorExited(); manager()->notifyInferiorExited();
} }
void TcfEngine::startDebugger(const DebuggerStartParametersPtr &sp) void TcfEngine::startDebugger(const DebuggerRunControl *runControl)
{ {
setState(InferiorRunningRequested); setState(InferiorRunningRequested);
showStatusMessage(tr("Running requested..."), 5000); showStatusMessage(tr("Running requested..."), 5000);
const int pos = sp->remoteChannel.indexOf(QLatin1Char(':')); const int pos = runControl->sp().remoteChannel.indexOf(QLatin1Char(':'));
const QString host = sp->remoteChannel.left(pos); const QString host = runControl->sp().remoteChannel.left(pos);
const quint16 port = sp->remoteChannel.mid(pos + 1).toInt(); const quint16 port = runControl->sp().remoteChannel.mid(pos + 1).toInt();
//QTimer::singleShot(0, this, SLOT(runInferior())); //QTimer::singleShot(0, this, SLOT(runInferior()));
m_socket->connectToHost(host, port); m_socket->connectToHost(host, port);
emit startSuccessful(); emit startSuccessful();

View File

@@ -75,7 +75,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
void startDebugger(const DebuggerStartParametersPtr &sp); void startDebugger(const DebuggerRunControl *runControl);
void exitDebugger(); void exitDebugger();
void continueInferior(); void continueInferior();

View File

@@ -38,8 +38,9 @@
#include "components/expressionquerywidget.h" #include "components/expressionquerywidget.h"
#include "components/objectpropertiesview.h" #include "components/objectpropertiesview.h"
#include <debugger/debuggerrunner.h> #include <debugger/debuggermanager.h>
#include <debugger/debuggermainwindow.h> #include <debugger/debuggermainwindow.h>
#include <debugger/debuggerrunner.h>
#include <debugger/debuggeruiswitcher.h> #include <debugger/debuggeruiswitcher.h>
#include <debugger/debuggerconstants.h> #include <debugger/debuggerconstants.h>
@@ -539,8 +540,8 @@ QString QmlInspector::attachToQmlViewerAsExternalApp(ProjectExplorer::Project *p
ProjectExplorer::Environment customEnv = ProjectExplorer::Environment::systemEnvironment(); // empty env by default ProjectExplorer::Environment customEnv = ProjectExplorer::Environment::systemEnvironment(); // empty env by default
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort())); customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
Debugger::Internal::DebuggerRunControl *debuggableRunControl = createDebuggerRunControl(runConfig, Debugger::DebuggerRunControl *debuggableRunControl =
dlg.qmlViewerPath(), dlg.qmlViewerArguments()); createDebuggerRunControl(runConfig, dlg.qmlViewerPath(), dlg.qmlViewerArguments());
return executeDebuggerRunControl(debuggableRunControl, &customEnv); return executeDebuggerRunControl(debuggableRunControl, &customEnv);
} }
@@ -575,11 +576,11 @@ QString QmlInspector::attachToExternalCppAppWithQml(ProjectExplorer::Project *pr
ProjectExplorer::Environment customEnv = runConfig->environment(); ProjectExplorer::Environment customEnv = runConfig->environment();
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort())); customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
Debugger::Internal::DebuggerRunControl *debuggableRunControl = createDebuggerRunControl(runConfig); Debugger::DebuggerRunControl *debuggableRunControl = createDebuggerRunControl(runConfig);
return executeDebuggerRunControl(debuggableRunControl, &customEnv); return executeDebuggerRunControl(debuggableRunControl, &customEnv);
} }
QString QmlInspector::executeDebuggerRunControl(Debugger::Internal::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment) QString QmlInspector::executeDebuggerRunControl(Debugger::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment)
{ {
ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance();
@@ -597,26 +598,26 @@ QString QmlInspector::executeDebuggerRunControl(Debugger::Internal::DebuggerRunC
return QString(tr("A valid run control was not registered in Qt Creator for this project run configuration."));; return QString(tr("A valid run control was not registered in Qt Creator for this project run configuration."));;
} }
Debugger::Internal::DebuggerRunControl *QmlInspector::createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Debugger::DebuggerRunControl *QmlInspector::createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig,
const QString &executableFile, const QString &executableArguments) const QString &executableFile, const QString &executableArguments)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
const QList<Debugger::Internal::DebuggerRunControlFactory *> factories = pm->getObjects<Debugger::Internal::DebuggerRunControlFactory>(); const QList<Debugger::DebuggerRunControlFactory *> factories = pm->getObjects<Debugger::DebuggerRunControlFactory>();
ProjectExplorer::RunControl *runControl = 0; ProjectExplorer::RunControl *runControl = 0;
if (m_debugMode == QmlProjectWithCppPlugins) { if (m_debugMode == QmlProjectWithCppPlugins) {
Debugger::DebuggerStartParameters sp;
const Debugger::DebuggerStartParametersPtr sp(new Debugger::DebuggerStartParameters); sp.startMode = Debugger::StartExternal;
sp->startMode = Debugger::StartExternal; sp.executable = executableFile;
sp->executable = executableFile; sp.processArgs = executableArguments.split(QLatin1Char(' '));
sp->processArgs = executableArguments.split(QLatin1Char(' '));
runControl = factories.first()->create(sp); runControl = factories.first()->create(sp);
return qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl); return qobject_cast<Debugger::DebuggerRunControl *>(runControl);
}
} else if (m_debugMode == CppProjectWithQmlEngines) { if (m_debugMode == CppProjectWithQmlEngines) {
if (factories.length() && factories.first()->canRun(runConfig, ProjectExplorer::Constants::DEBUGMODE)) { if (factories.length() && factories.first()->canRun(runConfig, ProjectExplorer::Constants::DEBUGMODE)) {
runControl = factories.first()->create(runConfig, ProjectExplorer::Constants::DEBUGMODE); runControl = factories.first()->create(runConfig, ProjectExplorer::Constants::DEBUGMODE);
return qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl); return qobject_cast<Debugger::DebuggerRunControl *>(runControl);
} }
} }

View File

@@ -62,11 +62,10 @@ namespace ProjectExplorer {
namespace Core { namespace Core {
class IContext; class IContext;
} }
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerRunControl; class DebuggerRunControl;
} // Internal }
} // Debugger
namespace Qml { namespace Qml {
@@ -136,10 +135,10 @@ private slots:
private: private:
void updateMenuActions(); void updateMenuActions();
Debugger::Internal::DebuggerRunControl *createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Debugger::DebuggerRunControl *createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig,
const QString &executableFile = QString(), const QString &executableFile = QString(),
const QString &executableArguments = QString()); const QString &executableArguments = QString());
QString executeDebuggerRunControl(Debugger::Internal::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment); QString executeDebuggerRunControl(Debugger::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment);
QString attachToQmlViewerAsExternalApp(ProjectExplorer::Project *project); QString attachToQmlViewerAsExternalApp(ProjectExplorer::Project *project);
QString attachToExternalCppAppWithQml(ProjectExplorer::Project *project); QString attachToExternalCppAppWithQml(ProjectExplorer::Project *project);

View File

@@ -42,6 +42,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <debugger/debuggermanager.h> #include <debugger/debuggermanager.h>
#include <debugger/debuggerrunner.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -459,7 +460,9 @@ void MaemoDebugRunControl::handleRemoteOutput(const QString &output)
void MaemoDebugRunControl::startDebugging() void MaemoDebugRunControl::startDebugging()
{ {
m_debuggerManager->startNewDebugger(m_startParams); Debugger::DebuggerRunControl *runControl =
new Debugger::DebuggerRunControl(m_debuggerManager, *m_startParams.data());
m_debuggerManager->startNewDebugger(runControl);
} }
void MaemoDebugRunControl::stopInternal() void MaemoDebugRunControl::stopInternal()

View File

@@ -52,6 +52,7 @@
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <debugger/debuggermanager.h> #include <debugger/debuggermanager.h>
#include <debugger/debuggerrunner.h>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
@@ -944,7 +945,10 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun
void S60DeviceDebugRunControl::handleLauncherFinished() void S60DeviceDebugRunControl::handleLauncherFinished()
{ {
emit appendMessage(this, tr("Launching debugger..."), false); emit appendMessage(this, tr("Launching debugger..."), false);
Debugger::DebuggerManager::instance()->startNewDebugger(m_startParams); Debugger::DebuggerManager *dm = Debugger::DebuggerManager::instance();
Debugger::DebuggerRunControl *runControl =
new Debugger::DebuggerRunControl(dm, *m_startParams.data());
dm->startNewDebugger(runControl);
} }
void S60DeviceDebugRunControl::debuggingFinished() void S60DeviceDebugRunControl::debuggingFinished()