Commit 80f52cce authored by hjk's avatar hjk

debugger: tie engine creation close to runconfiguration creation

We'd like to be able to restart a debugger engine at some point of time.
parent 38e2ba8c
......@@ -174,9 +174,8 @@ RunControl *DebuggerRunControlFactory::create
DebuggerRunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp,
RunConfiguration *runConfiguration)
{
DebuggerRunControl *runControl = new DebuggerRunControl(runConfiguration);
runControl->setEnabledEngines(m_enabledEngines);
runControl->createEngine(sp);
DebuggerRunControl *runControl =
new DebuggerRunControl(runConfiguration, m_enabledEngines, sp);
if (!runControl->engine()) {
qDebug() << "FAILED TO CREATE ENGINE";
delete runControl;
......@@ -187,7 +186,8 @@ DebuggerRunControl *DebuggerRunControlFactory::create(const DebuggerStartParamet
return runControl;
}
QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
QWidget *DebuggerRunControlFactory::createConfigurationWidget
(RunConfiguration *runConfiguration)
{
// NBS TODO: Add GDB-specific configuration widget
Q_UNUSED(runConfiguration)
......@@ -201,12 +201,14 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *
//
////////////////////////////////////////////////////////////////////////
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration)
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
DebuggerEngineType enabledEngines, const DebuggerStartParameters &sp)
: RunControl(runConfiguration, ProjectExplorer::Constants::DEBUGMODE)
{
m_running = false;
m_enabledEngines = enabledEngines;
m_engine = 0;
m_enabledEngines = AllEngineTypes;
createEngine(sp);
}
DebuggerRunControl::~DebuggerRunControl()
......@@ -316,15 +318,9 @@ DebuggerEngineType DebuggerRunControl::engineForMode(DebuggerStartMode startMode
#endif
}
void DebuggerRunControl::setEnabledEngines(DebuggerEngineType enabledEngines)
{
m_enabledEngines = enabledEngines;
}
void DebuggerRunControl::createEngine(const DebuggerStartParameters &sp)
{
// Figure out engine according to toolchain, executable, attach or default.
DebuggerEngineType engineType = NoEngineType;
QString errorMessage;
QString settingsIdHint;
......
......@@ -59,21 +59,21 @@ class DEBUGGER_EXPORT DebuggerRunControlFactory
public:
DebuggerRunControlFactory(QObject *parent, DebuggerEngineType enabledEngines);
// ProjectExplorer::IRunControlFactory
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const;
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration
*runConfiguration, const QString &mode);
QString displayName() const;
QWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration
*runConfiguration);
// This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
// FIXME: What to do in case of a 0 runConfiguration?
typedef ProjectExplorer::RunConfiguration RunConfiguration;
typedef ProjectExplorer::RunControl RunControl;
DebuggerRunControl *create(const DebuggerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
RunConfiguration *runConfiguration = 0);
// ProjectExplorer::IRunControlFactory
// FIXME: Used by qmljsinspector.cpp:469
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
private:
QString displayName() const;
QWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
DebuggerEngineType m_enabledEngines;
};
......@@ -86,7 +86,8 @@ class DEBUGGER_EXPORT DebuggerRunControl
Q_OBJECT
public:
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration);
DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
DebuggerEngineType enabledEngines, const DebuggerStartParameters &sp);
~DebuggerRunControl();
// ProjectExplorer::RunControl
......
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