diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 6ca5c776cbd98240cda56f91ebbdf9faf0671885..0177aa79969920277ce26157f9ae595694ef4f01 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -741,7 +741,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa const QString extensionFileName = extensionFi.fileName(); // Prepare arguments QStringList arguments; - const bool isRemote = sp.startMode == AttachToRemote; + const bool isRemote = sp.startMode == AttachToRemoteServer; if (isRemote) { // Must be first arguments << QLatin1String("-remote") << sp.remoteChannel; } else { @@ -767,7 +767,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa nativeArguments.push_back(blank); nativeArguments += QDir::toNativeSeparators(sp.executable); break; - case AttachToRemote: + case AttachToRemoteServer: break; case AttachExternal: case AttachCrashedExternal: @@ -942,7 +942,7 @@ void CdbEngine::shutdownEngine() if (startParameters().startMode == AttachExternal || startParameters().startMode == AttachCrashedExternal) detachDebugger(); // Remote requires a bit more force to quit. - if (m_effectiveStartMode == AttachToRemote) { + if (m_effectiveStartMode == AttachToRemoteServer) { postCommand(m_extensionCommandPrefixBA + "shutdownex", 0); postCommand("qq", 0); } else { @@ -1152,7 +1152,7 @@ void CdbEngine::doContinueInferior() bool CdbEngine::canInterruptInferior() const { - return m_effectiveStartMode != AttachToRemote && inferiorPid(); + return m_effectiveStartMode != AttachToRemoteServer && inferiorPid(); } void CdbEngine::interruptInferior() diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index cfdadbf127a88ad0787bd16bcccbe9daccb829c7..fa179279ead8dad3d639f242359d507e2b28eb36 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -125,7 +125,8 @@ enum DebuggerStartMode AttachExternal, // Attach to running process by process id AttachCrashedExternal, // Attach to crashed process by process id AttachCore, // Attach to a core file - AttachToRemote, // Start and attach to a remote process + AttachToRemoteServer, // Attach to a running remote server + StartRemote, // Start and attach to a remote process AttachToQmlPort, // Attach to QML debugging port StartRemoteGdb, // Start gdb itself remotely StartRemoteEngine // Start ipc guest engine on other machine diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 6d27e1f03e1902d6de93b8f0facfb1ab48d6a335..24536b0278172d7e6ff08f7f914d80921f07eba4 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1215,7 +1215,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID); sp.toolChainAbi = Abi::hostAbi(); } else if (port) { - sp.startMode = AttachToRemote; + sp.startMode = AttachToRemoteServer; sp.remoteChannel = remoteChannel; sp.executable = it->section('@', 1, 1); if (sp.remoteChannel.isEmpty()) { @@ -1521,7 +1521,7 @@ void DebuggerPluginPrivate::attachRemote(const QString &spec) sp.executable = spec.section('@', 1, 1); sp.remoteArchitecture = spec.section('@', 2, 2); sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel); - sp.startMode = AttachToRemote; + sp.startMode = AttachToRemoteServer; sp.toolChainAbi = anyAbiOfBinary(sp.executable); if (DebuggerRunControl *rc = createDebugger(sp)) startDebugger(rc); @@ -1537,7 +1537,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession() ProjectExplorer::Abi::WindowsMsvc2010Flavor, ProjectExplorer::Abi::PEFormat, hostAbi.wordWidth()); - sp.startMode = AttachToRemote; + sp.startMode = AttachToRemoteServer; StartRemoteCdbDialog dlg(mainWindow()); QString previousConnection = configValue(connectionKey).toString(); if (previousConnection.isEmpty()) @@ -1606,7 +1606,6 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection. if (!sp.debuggerCommand.isEmpty()) sp.toolChainAbi = ProjectExplorer::Abi(); - sp.startMode = AttachToRemote; sp.overrideStartScript = dlg.overrideStartScript(); sp.useServerStartScript = dlg.useServerStartScript(); sp.serverStartScript = dlg.serverStartScript(); @@ -1614,12 +1613,21 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b sp.debugInfoLocation = dlg.debugInfoLocation(); if (sp.debugInfoLocation.isEmpty()) sp.debugInfoLocation = sp.sysroot + "/usr/lib/debug"; + if (sp.debugSourceLocation.isEmpty()) { + QString base = sp.sysroot + "/usr/src/debug/"; + sp.debugSourceLocation.append(base + "qt5base/src/corelib"); + sp.debugSourceLocation.append(base + "qt5base/src/gui"); + sp.debugSourceLocation.append(base + "qt5base/src/network"); + sp.debugSourceLocation.append(base + "qt5base/src/v8"); + sp.debugSourceLocation.append(base + "qtdeclarative/src/declarative/qml"); + } return true; } void DebuggerPluginPrivate::startRemoteApplication() { DebuggerStartParameters sp; + sp.startMode = StartRemote; if (queryRemoteParameters(sp, true)) if (RunControl *rc = createDebugger(sp)) startDebugger(rc); @@ -1630,6 +1638,7 @@ void DebuggerPluginPrivate::attachRemoteApplication() DebuggerStartParameters sp; if (!queryRemoteParameters(sp, false)) return; + sp.startMode = AttachToRemoteServer; sp.useServerStartScript = false; sp.serverStartScript.clear(); if (RunControl *rc = createDebugger(sp)) diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 6a91c7d67cb0a1ea405b18b2f9d45447d5eb8cc6..f6dc665ed0f65958f1223240f7e48aac00cb006e 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -459,7 +459,7 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode, case StartRemoteGdb: result.push_back(GdbEngineType); break; - case AttachToRemote: + case AttachToRemoteServer: if (!hardConstraintsOnly) { #ifdef Q_OS_WIN result.push_back(CdbEngineType); @@ -509,7 +509,7 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp) return result; } - if (sp.startMode != AttachToRemote && !sp.executable.isEmpty()) + if (sp.startMode != AttachToRemoteServer && !sp.executable.isEmpty()) result = enginesForExecutable(sp.executable); if (!result.isEmpty()) return result; diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index 79d7485e3b04cf9e3c074b3968102b125154e6cf..206ff65884157ec3da15e1d15ab1c99d0e2f1328 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -109,6 +109,7 @@ public: QString serverStartScript; QString sysroot; QString debugInfoLocation; + QStringList debugSourceLocation; QByteArray remoteDumperLib; QByteArray remoteSourcesDir; QString remoteMountPoint; diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index dc793626569483599716ddc7756e19554bf6ec86..271ea7c6bfe377e658fc6a1e373ab771082bc742 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -1099,7 +1099,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic() m_debuggingHelperState = DebuggingHelperLoadTried; QByteArray dlopenLib; const DebuggerStartMode startMode = startParameters().startMode; - if (startMode == AttachToRemote || startMode == StartRemoteGdb) + if (startMode == AttachToRemoteServer || startMode == StartRemoteGdb) dlopenLib = startParameters().remoteDumperLib; else dlopenLib = qtDumperLibraryName().toLocal8Bit(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index f6641302e3ce0eeae266278bcb61d00371236454..68b28e49373fba73c11c0bf32a675293433219ac 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1955,7 +1955,7 @@ AbstractGdbAdapter *GdbEngine::createAdapter() switch (sp.startMode) { case AttachCore: return new CoreGdbAdapter(this); - case AttachToRemote: + case AttachToRemoteServer: return new RemoteGdbServerAdapter(this); case StartRemoteGdb: return new RemotePlainGdbAdapter(this); @@ -4774,29 +4774,29 @@ void GdbEngine::handleInferiorPrepared() { typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap; typedef SourcePathMap::const_iterator SourcePathMapIterator; + const DebuggerStartParameters &sp = startParameters(); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); // Apply source path mappings from global options. const SourcePathMap sourcePathMap = - DebuggerSourcePathMappingWidget::mergePlatformQtPath( - startParameters().qtInstallPath, + DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp.qtInstallPath, debuggerCore()->globalDebuggerOptions()->sourcePathMap); - - if (!sourcePathMap.isEmpty()) { - const SourcePathMapIterator cend = sourcePathMap.constEnd(); - for (SourcePathMapIterator it = sourcePathMap.constBegin(); it != cend; ++it) { - QByteArray command = "set substitute-path "; - command += it.key().toLocal8Bit(); - command += ' '; - command += it.value().toLocal8Bit(); - postCommand(command); - } + const SourcePathMapIterator cend = sourcePathMap.constEnd(); + SourcePathMapIterator it = sourcePathMap.constBegin(); + for ( ; it != cend; ++it) { + QByteArray command = "set substitute-path "; + command += it.key().toLocal8Bit(); + command += ' '; + command += it.value().toLocal8Bit(); + postCommand(command); } + if (!sp.sysroot.isEmpty()) + postCommand("set substitute-path / " + sp.sysroot.toLocal8Bit()); + // Initial attempt to set breakpoints. - if (startParameters().startMode != AttachCore - && !isSlaveEngine()) { + if (sp.startMode != AttachCore && !isSlaveEngine()) { showStatusMessage(tr("Setting breakpoints...")); showMessage(tr("Setting breakpoints...")); attemptBreakpointSynchronization(); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index b1cf4d01cf1602b08ab4660cb2ed647358dee0c6..3ea9bf0ea45fdad1faa19abe7355a73ab740e8c7 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -181,8 +181,10 @@ void RemoteGdbServerAdapter::setupInferior() m_engine->postCommand("set gnutarget " + gnuTarget); if (!sysroot.isEmpty()) m_engine->postCommand("set sysroot " + sysroot); - if (!sysroot.isEmpty()) + if (!debugInfoLocation.isEmpty()) m_engine->postCommand("set debug-file-directory " + debugInfoLocation); + foreach (const QString &src, sp.debugSourceLocation) + m_engine->postCommand("directory " + src.toLocal8Bit()); if (!solibPath.isEmpty()) m_engine->postCommand("set solib-search-path " + solibPath); if (!args.isEmpty()) @@ -291,7 +293,10 @@ void RemoteGdbServerAdapter::handleInterruptInferior(const GdbResponse &response void RemoteGdbServerAdapter::shutdownInferior() { - m_engine->defaultInferiorShutdown("kill"); + if (m_engine->startParameters().startMode == AttachToRemoteServer) + m_engine->defaultInferiorShutdown("detach"); + else + m_engine->defaultInferiorShutdown("kill"); } void RemoteGdbServerAdapter::shutdownAdapter() diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index e2e08861308f4983db73c1efab5339788e49a570..e3118f01fd644d9c1295c0c14b0599632a50b23d 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -163,7 +163,7 @@ void QmlEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); - if (startParameters().startMode == AttachToRemote) { + if (startParameters().startMode == AttachToRemoteServer) { emit requestRemoteSetup(); if (startParameters().qmlServerPort != quint16(-1)) notifyInferiorSetupOk(); @@ -330,7 +330,7 @@ void QmlEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); - if (!isSlaveEngine() && startParameters().startMode != AttachToRemote + if (!isSlaveEngine() && startParameters().startMode != AttachToRemoteServer && startParameters().startMode != AttachToQmlPort) startApplicationLauncher(); d->m_noDebugOutputTimer.start(); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp index 21b9dd8d373314173fbb019e35f48698e6c9dda3..e8bfd74a7bb0ce3de30db9cb861f7940d4ca3357 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp @@ -85,7 +85,7 @@ static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceR sp.remoteChannel = activeDeployConf->serialPortName(); sp.processArgs = rc->commandLineArguments(); if (rc->useQmlDebugger() && !rc->useCppDebugger()) - sp.startMode = Debugger::AttachToRemote; + sp.startMode = Debugger::AttachToRemoteServer; else sp.startMode = Debugger::StartInternal; diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 8cd1da2fcbcc061936be6c296cabf7890e611283..1433a898acf9314c5789ccc1847cce104d7bebc7 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -105,7 +105,7 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R if (runConfig->activeQt4BuildConfiguration()->qtVersion()) params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); params.toolChainAbi = runConfig->abi(); - params.startMode = AttachToRemote; + params.startMode = AttachToRemoteServer; params.executable = runConfig->localExecutableFilePath(); params.debuggerCommand = runConfig->gdbCmd(); params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1"); @@ -118,7 +118,7 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu"); } else { - params.startMode = AttachToRemote; + params.startMode = AttachToRemoteServer; } params.displayName = runConfig->displayName();