Commit fe8cead2 authored by Kai Koehne's avatar Kai Koehne Committed by hjk

Debugger: Make language to debug (QML/CPP) explicit

Make the choice of language part of the DebuggerStartParameters,
instead of deriving it indirectly from the current project. This
prevents e.g. the QmlCppEngine to be used when loading core files.

Change-Id: I9d1c9ab318ba789abe3a6ea0478ebda71857e793
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent e46a5579
...@@ -130,7 +130,6 @@ enum DebuggerStartMode ...@@ -130,7 +130,6 @@ enum DebuggerStartMode
AttachToRemoteServer, // Attach to a running gdbserver AttachToRemoteServer, // Attach to a running gdbserver
AttachToRemoteProcess, // Attach to a running remote process AttachToRemoteProcess, // Attach to a running remote process
StartRemoteProcess, // Start and attach to a remote process StartRemoteProcess, // Start and attach to a remote process
AttachToQmlPort, // Attach to QML debugging port
StartRemoteGdb, // Start gdb itself remotely StartRemoteGdb, // Start gdb itself remotely
StartRemoteEngine // Start ipc guest engine on other machine StartRemoteEngine // Start ipc guest engine on other machine
}; };
......
...@@ -1844,7 +1844,7 @@ void DebuggerPluginPrivate::attachToQmlPort() ...@@ -1844,7 +1844,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
sp.qmlServerPort = dlg.port(); sp.qmlServerPort = dlg.port();
sp.sysroot = dlg.sysroot(); sp.sysroot = dlg.sysroot();
sp.startMode = AttachToQmlPort; sp.startMode = AttachToRemoteServer;
// //
// get files from all the projects in the session // get files from all the projects in the session
...@@ -2713,6 +2713,14 @@ static QString formatStartParameters(DebuggerStartParameters &sp) ...@@ -2713,6 +2713,14 @@ static QString formatStartParameters(DebuggerStartParameters &sp)
QTextStream str(&rc); QTextStream str(&rc);
str << "Start parameters: '" << sp.displayName << "' mode: " << sp.startMode str << "Start parameters: '" << sp.displayName << "' mode: " << sp.startMode
<< "\nABI: " << sp.toolChainAbi.toString() << '\n'; << "\nABI: " << sp.toolChainAbi.toString() << '\n';
str << "Languages: ";
if (sp.languages == AnyLanguage)
str << "any";
if (sp.languages & CppLanguage)
str << "c++ ";
if (sp.languages & QmlLanguage)
str << "qml";
str << '\n';
if (!sp.executable.isEmpty()) { if (!sp.executable.isEmpty()) {
str << "Executable: " << QDir::toNativeSeparators(sp.executable) str << "Executable: " << QDir::toNativeSeparators(sp.executable)
<< ' ' << sp.processArgs; << ' ' << sp.processArgs;
......
...@@ -365,7 +365,8 @@ RunConfiguration *DebuggerRunControl::runConfiguration() const ...@@ -365,7 +365,8 @@ RunConfiguration *DebuggerRunControl::runConfiguration() const
// //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain) static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain,
DebuggerLanguages languages)
{ {
QList<DebuggerEngineType> result; QList<DebuggerEngineType> result;
switch (toolChain.binaryFormat()) { switch (toolChain.binaryFormat()) {
...@@ -373,6 +374,8 @@ static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain) ...@@ -373,6 +374,8 @@ static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain)
case Abi::MachOFormat: case Abi::MachOFormat:
result.push_back(LldbEngineType); result.push_back(LldbEngineType);
result.push_back(GdbEngineType); result.push_back(GdbEngineType);
if (languages & QmlLanguage)
result.push_back(QmlEngineType);
break; break;
case Abi::PEFormat: case Abi::PEFormat:
if (toolChain.osFlavor() == Abi::WindowsMSysFlavor) { if (toolChain.osFlavor() == Abi::WindowsMSysFlavor) {
...@@ -382,6 +385,8 @@ static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain) ...@@ -382,6 +385,8 @@ static QList<DebuggerEngineType> enginesForToolChain(const Abi &toolChain)
result.push_back(CdbEngineType); result.push_back(CdbEngineType);
result.push_back(GdbEngineType); result.push_back(GdbEngineType);
} }
if (languages & QmlLanguage)
result.push_back(QmlEngineType);
break; break;
case Abi::RuntimeQmlFormat: case Abi::RuntimeQmlFormat:
result.push_back(QmlEngineType); result.push_back(QmlEngineType);
...@@ -435,9 +440,22 @@ static QList<DebuggerEngineType> enginesForExecutable(const QString &executable) ...@@ -435,9 +440,22 @@ static QList<DebuggerEngineType> enginesForExecutable(const QString &executable)
// Debugger type for mode. // Debugger type for mode.
static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
DebuggerLanguages languages,
bool hardConstraintsOnly) bool hardConstraintsOnly)
{ {
QList<DebuggerEngineType> result; QList<DebuggerEngineType> result;
if (languages == QmlLanguage) {
QTC_ASSERT(startMode == StartInternal
|| startMode == AttachToRemoteServer,
qDebug() << "qml debugging not supported for mode"
<< startMode);
// Qml language only
result.push_back(QmlEngineType);
return result;
}
switch (startMode) { switch (startMode) {
case NoStartMode: case NoStartMode:
break; break;
...@@ -449,6 +467,9 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, ...@@ -449,6 +467,9 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
result.push_back(CdbEngineType); // Preferably Windows debugger for attaching locally. result.push_back(CdbEngineType); // Preferably Windows debugger for attaching locally.
#endif #endif
result.push_back(GdbEngineType); result.push_back(GdbEngineType);
if (languages & QmlLanguage)
result.push_back(QmlEngineType);
} }
break; break;
case AttachCore: case AttachCore:
...@@ -460,6 +481,8 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, ...@@ -460,6 +481,8 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
case StartRemoteProcess: case StartRemoteProcess:
case StartRemoteGdb: case StartRemoteGdb:
result.push_back(GdbEngineType); result.push_back(GdbEngineType);
if (languages & QmlLanguage)
result.push_back(QmlEngineType);
break; break;
case AttachToRemoteProcess: case AttachToRemoteProcess:
case AttachToRemoteServer: case AttachToRemoteServer:
...@@ -468,6 +491,9 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, ...@@ -468,6 +491,9 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
result.push_back(CdbEngineType); result.push_back(CdbEngineType);
#endif #endif
result.push_back(GdbEngineType); result.push_back(GdbEngineType);
if (languages & QmlLanguage)
result.push_back(QmlEngineType);
} }
break; break;
case AttachCrashedExternal: case AttachCrashedExternal:
...@@ -478,9 +504,6 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, ...@@ -478,9 +504,6 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
// For now thats the only supported IPC engine. // For now thats the only supported IPC engine.
result.push_back(LldbEngineType); result.push_back(LldbEngineType);
break; break;
case AttachToQmlPort:
result.push_back(QmlEngineType); // Only QML can do this
break;
} }
return result; return result;
} }
...@@ -494,14 +517,14 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp) ...@@ -494,14 +517,14 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp)
if (!result.isEmpty()) if (!result.isEmpty())
return result; return result;
result = enginesForMode(sp.startMode, true); result = enginesForMode(sp.startMode, sp.languages, true);
if (!result.isEmpty()) if (!result.isEmpty())
return result; return result;
// 'hard constraints' done (with the exception of QML ABI checked here), // 'hard constraints' done (with the exception of QML ABI checked here),
// further try to restrict available engines. // further try to restrict available engines.
if (sp.toolChainAbi.isValid()) { if (sp.toolChainAbi.isValid()) {
result = enginesForToolChain(sp.toolChainAbi); result = enginesForToolChain(sp.toolChainAbi, sp.languages);
if (!result.isEmpty()) if (!result.isEmpty())
return result; return result;
} }
...@@ -519,7 +542,7 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp) ...@@ -519,7 +542,7 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp)
if (!result.isEmpty()) if (!result.isEmpty())
return result; return result;
result = enginesForMode(sp.startMode, false); result = enginesForMode(sp.startMode, sp.languages, false);
return result; return result;
} }
...@@ -577,27 +600,19 @@ static inline bool canUseEngine(DebuggerEngineType et, ...@@ -577,27 +600,19 @@ static inline bool canUseEngine(DebuggerEngineType et,
DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartParameters &sp) DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartParameters &sp)
{ {
ConfigurationCheck result; ConfigurationCheck result;
const unsigned activeLangs = debuggerCore()->activeLanguages();
const bool qmlLanguage = activeLangs & QmlLanguage;
const bool cppLanguage = activeLangs & CppLanguage;
if (debug) if (debug)
qDebug().nospace() << "checkDebugConfiguration " << sp.toolChainAbi.toString() qDebug().nospace() << "checkDebugConfiguration " << sp.toolChainAbi.toString()
<< " Start mode=" << sp.startMode << " Executable=" << sp.executable << " Start mode=" << sp.startMode << " Executable=" << sp.executable
<< " Debugger command=" << sp.debuggerCommand; << " Debugger command=" << sp.debuggerCommand;
// Get all applicable types. // Get all applicable types.
QList<DebuggerEngineType> requiredTypes; QList<DebuggerEngineType> requiredTypes = engineTypes(sp);
if (qmlLanguage && !cppLanguage) {
requiredTypes.push_back(QmlEngineType);
} else {
requiredTypes = engineTypes(sp);
}
if (requiredTypes.isEmpty()) { if (requiredTypes.isEmpty()) {
result.errorMessage = QLatin1String("Internal error: Unable to determine debugger engine type for this configuration"); result.errorMessage = QLatin1String("Internal error: Unable to determine debugger engine type for this configuration");
return result; return result;
} }
if (debug) if (debug)
qDebug() << " Required: " << engineTypeNames(requiredTypes); qDebug() << " Required: " << engineTypeNames(requiredTypes);
// Filter out disables types, command line + current settings. // Filter out disabled types, command line + current settings.
unsigned cmdLineEnabledEngines = debuggerCore()->enabledEngines(); unsigned cmdLineEnabledEngines = debuggerCore()->enabledEngines();
#ifdef WITH_LLDB #ifdef WITH_LLDB
if (!Core::ICore::settings()->value(QLatin1String("LLDB/enabled")).toBool()) if (!Core::ICore::settings()->value(QLatin1String("LLDB/enabled")).toBool())
...@@ -605,6 +620,7 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa ...@@ -605,6 +620,7 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa
#else #else
cmdLineEnabledEngines &= ~LldbEngineType; cmdLineEnabledEngines &= ~LldbEngineType;
#endif #endif
DebuggerEngineType usableType = NoEngineType; DebuggerEngineType usableType = NoEngineType;
QList<DebuggerEngineType> unavailableTypes; QList<DebuggerEngineType> unavailableTypes;
foreach (DebuggerEngineType et, requiredTypes) { foreach (DebuggerEngineType et, requiredTypes) {
...@@ -644,13 +660,17 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa ...@@ -644,13 +660,17 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa
// Anything left: Happy. // Anything left: Happy.
result.errorMessage.clear(); result.errorMessage.clear();
result.errorDetails.clear(); result.errorDetails.clear();
if (qmlLanguage && cppLanguage
&& usableType != QmlEngineType) {
result.masterSlaveEngineTypes.first = QmlCppEngineType; // Could we actually use a combined qml/cpp-engine?
result.masterSlaveEngineTypes.second = usableType; if (usableType != QmlEngineType
} else { && requiredTypes.contains(QmlEngineType)) {
result.masterSlaveEngineTypes.first = usableType; result.masterSlaveEngineTypes.first = QmlCppEngineType;
} result.masterSlaveEngineTypes.second = usableType;
} else {
result.masterSlaveEngineTypes.first = usableType;
}
if (debug) if (debug)
qDebug() << engineTypeName(result.masterSlaveEngineTypes.first) << engineTypeName(result.masterSlaveEngineTypes.second); qDebug() << engineTypeName(result.masterSlaveEngineTypes.first) << engineTypeName(result.masterSlaveEngineTypes.second);
return result; return result;
...@@ -757,9 +777,13 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu ...@@ -757,9 +777,13 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
} }
} }
if (debuggerCore()->isActiveDebugLanguage(QmlLanguage)) { if (runConfiguration->useCppDebugger())
sp.languages |= CppLanguage;
if (runConfiguration->useQmlDebugger()) {
sp.qmlServerAddress = _("127.0.0.1"); sp.qmlServerAddress = _("127.0.0.1");
sp.qmlServerPort = runConfiguration->qmlDebugServerPort(); sp.qmlServerPort = runConfiguration->qmlDebugServerPort();
sp.languages |= QmlLanguage;
// Makes sure that all bindings go through the JavaScript engine, so that // Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit! // breakpoints are actually hit!
......
...@@ -61,6 +61,7 @@ public: ...@@ -61,6 +61,7 @@ public:
attachPID(-1), attachPID(-1),
useTerminal(false), useTerminal(false),
breakOnMain(false), breakOnMain(false),
languages(AnyLanguage),
qmlServerAddress(QLatin1String("127.0.0.1")), qmlServerAddress(QLatin1String("127.0.0.1")),
qmlServerPort(ProjectExplorer::Constants::QML_DEFAULT_DEBUG_SERVER_PORT), qmlServerPort(ProjectExplorer::Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
useServerStartScript(false), useServerStartScript(false),
...@@ -87,6 +88,7 @@ public: ...@@ -87,6 +88,7 @@ public:
qint64 attachPID; qint64 attachPID;
bool useTerminal; bool useTerminal;
bool breakOnMain; bool breakOnMain;
DebuggerLanguages languages;
// Used by AttachCrashedExternal. // Used by AttachCrashedExternal.
QString crashParameter; QString crashParameter;
...@@ -98,6 +100,7 @@ public: ...@@ -98,6 +100,7 @@ public:
QString projectBuildDirectory; QString projectBuildDirectory;
QStringList projectSourceFiles; QStringList projectSourceFiles;
QString qtInstallPath; QString qtInstallPath;
// Used by remote debugging. // Used by remote debugging.
QString remoteChannel; QString remoteChannel;
......
...@@ -373,12 +373,12 @@ void QmlEngine::runEngine() ...@@ -373,12 +373,12 @@ void QmlEngine::runEngine()
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (!isSlaveEngine() && startParameters().startMode != AttachToRemoteServer if (!isSlaveEngine()) {
&& startParameters().startMode != AttachToQmlPort) if (startParameters().startMode != AttachToRemoteServer)
startApplicationLauncher(); startApplicationLauncher();
else
if (startParameters().startMode == AttachToQmlPort) beginConnection();
beginConnection(); }
} }
void QmlEngine::startApplicationLauncher() void QmlEngine::startApplicationLauncher()
......
...@@ -100,11 +100,14 @@ static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceR ...@@ -100,11 +100,14 @@ static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceR
sp.qmlServerAddress = activeDeployConf->deviceAddress(); sp.qmlServerAddress = activeDeployConf->deviceAddress();
sp.qmlServerPort = rc->qmlDebugServerPort(); sp.qmlServerPort = rc->qmlDebugServerPort();
if (rc->useQmlDebugger()) { if (rc->useQmlDebugger()) {
sp.languages |= Debugger::QmlLanguage;
QString qmlArgs = rc->qmlCommandLineArguments(); QString qmlArgs = rc->qmlCommandLineArguments();
if (sp.processArgs.length()) if (sp.processArgs.length())
sp.processArgs.prepend(QLatin1Char(' ')); sp.processArgs.prepend(QLatin1Char(' '));
sp.processArgs.prepend(qmlArgs); sp.processArgs.prepend(qmlArgs);
} }
if (rc->useCppDebugger())
sp.languages |= Debugger::CppLanguage;
sp.communicationChannel = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationCodaTcpConnection? sp.communicationChannel = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationCodaTcpConnection?
Debugger::DebuggerStartParameters::CommunicationChannelTcpIp: Debugger::DebuggerStartParameters::CommunicationChannelTcpIp:
......
...@@ -97,10 +97,12 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R ...@@ -97,10 +97,12 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
DebuggerStartParameters params; DebuggerStartParameters params;
const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig(); const LinuxDeviceConfiguration::ConstPtr &devConf = runConfig->deviceConfig();
if (runConfig->useQmlDebugger()) { if (runConfig->useQmlDebugger()) {
params.languages |= QmlLanguage;
params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host; params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host;
params.qmlServerPort = -1; params.qmlServerPort = -1;
} }
if (runConfig->useCppDebugger()) { if (runConfig->useCppDebugger()) {
params.languages |= CppLanguage;
params.processArgs = runConfig->arguments(); params.processArgs = runConfig->arguments();
if (runConfig->activeQt4BuildConfiguration()->qtVersion()) if (runConfig->activeQt4BuildConfiguration()->qtVersion())
params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot();
......
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