Commit db671e82 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Avoid crashes when no C++-engine is available.



Check for valid runcontrols in various places and initialize
m_engine correcly. In the case of QML-Debugging, handle
NoEngineType.
Reviewed-by: default avatarLeandro T. C. Melo <leandro.melo@nokia.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
Task-number: QTCREATORBUG-2086
parent 9eccc9cd
......@@ -1790,7 +1790,9 @@ void DebuggerPluginPrivate::startExternalApplication()
&& (sp.processArgs.front() == _("@tcf@") || sp.processArgs.front() == _("@sym@")))
sp.toolChainType = ToolChain::RVCT_ARMV5;
startDebugger(m_debuggerRunControlFactory->create(sp));
if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
startDebugger(rc);
}
void DebuggerPluginPrivate::notifyCurrentEngine(int role, const QVariant &value)
......@@ -1820,7 +1822,7 @@ void DebuggerPluginPrivate::attachExternalApplication
sp.executable = binary;
sp.crashParameter = crashParameter;
sp.startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
DebuggerRunControl *rc = createDebugger(sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
......@@ -1843,7 +1845,7 @@ void DebuggerPluginPrivate::attachCore(const QString &core, const QString &exe)
sp.coreFile = core;
sp.displayName = tr("Core file \"%1\"").arg(core);
sp.startMode = AttachCore;
DebuggerRunControl *rc = createDebugger(sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
......@@ -1856,7 +1858,7 @@ void DebuggerPluginPrivate::attachRemote(const QString &spec)
sp.remoteArchitecture = spec.section('@', 2, 2);
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
sp.startMode = AttachToRemote;
DebuggerRunControl *rc = createDebugger(sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
......@@ -1902,7 +1904,8 @@ void DebuggerPluginPrivate::startRemoteApplication()
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
sp.sysRoot = dlg.sysRoot();
startDebugger(createDebugger(sp));
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &value)
......@@ -1940,7 +1943,8 @@ void DebuggerPluginPrivate::attachRemoteTcf()
sp.startMode = AttachTcf;
if (dlg.useServerStartScript())
sp.serverStartScript = dlg.serverStartScript();
startDebugger(createDebugger(sp));
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
bool DebuggerPluginPrivate::attachCmdLine()
......
......@@ -276,7 +276,8 @@ unsigned DebuggerRunnerPrivate::enabledEngines() const
DebuggerRunnerPrivate::DebuggerRunnerPrivate(RunConfiguration *runConfiguration,
unsigned enabledEngines) :
m_myRunConfiguration(runConfiguration)
m_engine(0)
, m_myRunConfiguration(runConfiguration)
, m_running(false)
, m_cmdLineEnabledEngines(enabledEngines)
{
......@@ -439,10 +440,11 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
&& !sp.executable.isEmpty())
engineType = engineForExecutable(enabledEngineTypes, sp.executable);
if (!engineType)
if (engineType == NoEngineType)
engineType = engineForMode(enabledEngineTypes, sp.startMode);
if (engineType != QmlEngineType && (activeLangs & QmlLanguage)) {
if ((engineType != QmlEngineType && engineType != NoEngineType)
&& (activeLangs & QmlLanguage)) {
if (activeLangs & CppLanguage) {
sp.cppEngineType = engineType;
engineType = QmlCppEngineType;
......
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