diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 0dfe144ea81..d4911d4f160 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -89,17 +89,10 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration * params.startMode = AttachToRemoteServer; params.displayName = AndroidManager::packageName(target); params.remoteSetupNeeded = true; - params.runConfiguration = runConfig; - DebuggerRunConfigurationAspect *aspect - = runConfig->extraAspect(); + auto aspect = runConfig->extraAspect(); if (aspect->useCppDebugger()) { - params.languages |= CppLanguage; Kit *kit = target->kit(); - params.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); - params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); - if (ToolChain *tc = ToolChainKitInformation::toolChain(kit)) - params.toolChainAbi = tc->targetAbi(); params.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process"); params.skipExecutableValidation = true; params.remoteChannel = runConfig->remoteChannel(); @@ -108,25 +101,20 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration * params.solibSearchPath.append(qtSoPaths(version)); } if (aspect->useQmlDebugger()) { - params.languages |= QmlLanguage; QTcpServer server; QTC_ASSERT(server.listen(QHostAddress::LocalHost) || server.listen(QHostAddress::LocalHostIPv6), return 0); params.qmlServerAddress = server.serverAddress().toString(); - params.remoteSetupNeeded = true; //TODO: Not sure if these are the right paths. - params.projectSourceDirectory = target->project()->projectDirectory().toString(); Kit *kit = target->kit(); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); if (version) { const QString qmlQtDir = version->versionInfo().value(QLatin1String("QT_INSTALL_QML")); params.additionalSearchDirectories = QStringList(qmlQtDir); } - params.projectSourceFiles = target->project()->files(Project::ExcludeGeneratedFiles); - params.projectBuildDirectory = target->activeBuildConfiguration()->buildDirectory().toString(); } - DebuggerRunControl * const debuggerRunControl = createDebuggerRunControl(params, errorMessage); + DebuggerRunControl * const debuggerRunControl = createDebuggerRunControl(params, runConfig, errorMessage); new AndroidDebugSupport(runConfig, debuggerRunControl); return debuggerRunControl; } diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 6409db30f87..c525440c0f4 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -543,7 +543,7 @@ void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bo QString pidString = QString::number(m_processPID); foreach (const QByteArray &msg, lines) { - const QString line = QString::fromUtf8(msg).trimmed(); + const QString line = QString::fromUtf8(msg).trimmed() + QLatin1Char('\n'); if (!line.contains(pidString)) continue; if (m_logCatRegExp.exactMatch(line)) { diff --git a/src/plugins/baremetal/baremetalruncontrolfactory.cpp b/src/plugins/baremetal/baremetalruncontrolfactory.cpp index e2dea237d49..7dd2fb7edfe 100644 --- a/src/plugins/baremetal/baremetalruncontrolfactory.cpp +++ b/src/plugins/baremetal/baremetalruncontrolfactory.cpp @@ -119,32 +119,19 @@ RunControl *BareMetalRunControlFactory::create( DebuggerStartParameters sp; - if (const ToolChain *tc = ToolChainKitInformation::toolChain(kit)) - sp.toolChainAbi = tc->targetAbi(); - - if (const Project *project = target->project()) { - sp.projectSourceDirectory = project->projectDirectory().toString(); - sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles); - - if (const BuildConfiguration *bc = target->activeBuildConfiguration()) { - sp.projectBuildDirectory = bc->buildDirectory().toString(); - if (const BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId())) { - foreach (const BuildStep *bs, bsl->steps()) { - const auto ds = qobject_cast(bs); - if (ds) { - if (!sp.commandsAfterConnect.endsWith("\n")) - sp.commandsAfterConnect.append("\n"); - sp.commandsAfterConnect.append(ds->gdbCommands().toLatin1()); - } + if (const BuildConfiguration *bc = target->activeBuildConfiguration()) { + if (const BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId())) { + foreach (const BuildStep *bs, bsl->steps()) { + if (auto ds = qobject_cast(bs)) { + if (!sp.commandsAfterConnect.endsWith("\n")) + sp.commandsAfterConnect.append("\n"); + sp.commandsAfterConnect.append(ds->gdbCommands().toLatin1()); } } } } sp.executable = bin; - sp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); - sp.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); - sp.languages |= CppLanguage; sp.processArgs = rc->arguments(); sp.startMode = AttachToRemoteServer; sp.displayName = rc->displayName(); @@ -156,8 +143,7 @@ RunControl *BareMetalRunControlFactory::create( if (p->startupMode() == GdbServerProvider::StartupOnNetwork) sp.remoteSetupNeeded = true; - sp.runConfiguration = rc; - DebuggerRunControl *runControl = createDebuggerRunControl(sp, errorMessage); + DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage); if (runControl && sp.remoteSetupNeeded) { const auto debugSupport = new BareMetalDebugSupport(dev, runControl); Q_UNUSED(debugSupport); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 13ddc1c7820..4a09e07a0a9 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -85,6 +85,14 @@ class DebuggerRunParameters : public DebuggerStartParameters public: DebuggerRunParameters() {} + DebuggerEngineType masterEngineType = NoEngineType; + DebuggerEngineType cppEngineType = NoEngineType; + + DebuggerLanguages languages = AnyLanguage; + bool breakOnMain = false; + bool multiProcess = false; // Whether to set detach-on-fork off. + + QString debuggerCommand; QString coreFile; QString overrideStartScript; // Used in attach to core and remote debugging QString startMessage; // First status message shown. @@ -93,7 +101,12 @@ public: QStringList debugSourceLocation; // Gdb "directory" QString serverStartScript; ProjectExplorer::IDevice::ConstPtr device; + QString sysRoot; bool isSnapshot = false; // Set if created internally. + ProjectExplorer::Abi toolChainAbi; + + QString projectSourceDirectory; + QStringList projectSourceFiles; // Used by AttachCrashedExternal. QString crashParameter; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a8d0fd4b854..261bbfb2a84 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2290,19 +2290,14 @@ static QString formatStartParameters(DebuggerRunParameters &sp) str << "PID: " << sp.attachPID << ' ' << sp.crashParameter << '\n'; if (!sp.projectSourceDirectory.isEmpty()) { str << "Project: " << QDir::toNativeSeparators(sp.projectSourceDirectory); - if (!sp.projectBuildDirectory.isEmpty()) - str << " (built: " << QDir::toNativeSeparators(sp.projectBuildDirectory) - << ')'; - str << '\n'; str << "Addtional Search Directories:" << sp.additionalSearchDirectories.join(QLatin1Char(' ')) << '\n'; } if (!sp.qmlServerAddress.isEmpty()) str << "QML server: " << sp.qmlServerAddress << ':' << sp.qmlServerPort << '\n'; - if (!sp.remoteChannel.isEmpty()) { + if (!sp.remoteChannel.isEmpty()) str << "Remote: " << sp.remoteChannel << '\n'; - } str << "Sysroot: " << sp.sysRoot << '\n'; str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1Char(':')) << '\n'; return rc; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 3181c6570df..36f7b1b3267 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -295,7 +295,7 @@ public: // detectable pieces, construct an Engine and a RunControl. void initialize(const DebuggerStartParameters &sp); void enrich(const RunConfiguration *runConfig, const Kit *kit); - void createRunControl(RunMode runMode = DebugRunMode); + void createRunControl(RunMode runMode); QString fullError() const { return m_errors.join(QLatin1Char('\n')); } // Result. @@ -326,9 +326,6 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const if (!m_runConfig) m_runConfig = runConfig; - if (!m_runConfig) - m_runConfig = m_rp.runConfiguration; - // Extract as much as possible from available RunConfiguration. if (auto localRc = qobject_cast(m_runConfig)) { m_rp.executable = localRc->executable(); @@ -398,17 +395,22 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const } if (m_runConfig) { - auto envAspect = m_runConfig->extraAspect(); - if (envAspect) + if (auto envAspect = m_runConfig->extraAspect()) m_rp.environment = envAspect->environment(); } - if (m_runConfig) - m_debuggerAspect = m_runConfig->extraAspect(); + if (ToolChain *tc = ToolChainKitInformation::toolChain(m_kit)) + m_rp.toolChainAbi = tc->targetAbi(); if (m_target) m_project = m_target->project(); + if (m_project && m_rp.projectSourceDirectory.isEmpty()) + m_rp.projectSourceDirectory = m_project->projectDirectory().toString(); + + if (m_project && m_rp.projectSourceFiles.isEmpty()) + m_rp.projectSourceFiles = m_project->files(Project::ExcludeGeneratedFiles); + // validate debugger if C++ debugging is enabled if (m_rp.languages & CppLanguage) { const QList tasks = DebuggerKitInformation::validateDebugger(m_kit); @@ -422,22 +424,15 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const m_rp.cppEngineType = DebuggerKitInformation::engineType(m_kit); m_rp.sysRoot = SysRootKitInformation::sysRoot(m_kit).toString(); m_rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(m_kit).toString(); - - if (auto toolChain = ToolChainKitInformation::toolChain(m_kit)) { - m_rp.toolChainAbi = toolChain->targetAbi(); - } - - if (m_target) { - if (const BuildConfiguration *buildConfig = m_target->activeBuildConfiguration()) - m_rp.projectBuildDirectory = buildConfig->buildDirectory().toString(); - } + m_rp.device = DeviceKitInformation::device(m_kit); if (m_project) { m_rp.projectSourceDirectory = m_project->projectDirectory().toString(); m_rp.projectSourceFiles = m_project->files(Project::ExcludeGeneratedFiles); } - m_rp.device = DeviceKitInformation::device(m_kit); + if (m_runConfig) + m_debuggerAspect = m_runConfig->extraAspect(); if (m_debuggerAspect) { m_rp.multiProcess = m_debuggerAspect->useMultiProcess(); @@ -446,6 +441,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const m_rp.languages |= CppLanguage; if (m_debuggerAspect->useQmlDebugger()) { + m_rp.languages |= QmlLanguage; if (m_rp.device && m_rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { QTcpServer server; const bool canListen = server.listen(QHostAddress::LocalHost) @@ -456,7 +452,6 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const } m_rp.qmlServerAddress = server.serverAddress().toString(); m_rp.qmlServerPort = server.serverPort(); - m_rp.languages |= QmlLanguage; // Makes sure that all bindings go through the JavaScript engine, so that // breakpoints are actually hit! @@ -495,6 +490,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const if (m_rp.masterEngineType == NoEngineType && m_debuggerAspect) { const bool useCppDebugger = m_debuggerAspect->useCppDebugger() && (m_rp.languages & CppLanguage); const bool useQmlDebugger = m_debuggerAspect->useQmlDebugger() && (m_rp.languages & QmlLanguage); + if (useQmlDebugger) { if (useCppDebugger) m_rp.masterEngineType = QmlCppEngineType; @@ -619,7 +615,7 @@ DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const DebuggerRunControlCreator creator; creator.m_rp = rp; creator.enrich(0, kit); - creator.createRunControl(); + creator.createRunControl(DebugRunMode); if (!creator.m_runControl) { ProjectExplorerPlugin::showRunErrorMessage(creator.fullError()); return 0; @@ -634,12 +630,15 @@ DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const /** * Main entry point for target plugins. */ -DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, QString *errorMessage) +DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, + RunConfiguration *runConfig, + QString *errorMessage, + RunMode runMode) { DebuggerRunControlCreator creator; creator.initialize(sp); - creator.enrich(sp.runConfiguration, 0); - creator.createRunControl(); + creator.enrich(runConfig, 0); + creator.createRunControl(runMode); if (errorMessage) *errorMessage = creator.fullError(); if (!creator.m_runControl) { @@ -658,7 +657,7 @@ bool fillParametersFromRunConfiguration(DebuggerStartParameters *sp, const RunCo DebuggerRunControlCreator creator; creator.initialize(*sp); creator.enrich(runConfig, 0); - creator.createRunControl(); + creator.createRunControl(DebugRunMode); if (errorMessage) *errorMessage = creator.fullError(); *sp = creator.m_rp; diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 0fb933811ec..479c545e37b 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -48,7 +48,9 @@ class DebuggerRunControlCreator; } DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, - QString *errorMessage); + ProjectExplorer::RunConfiguration *runConfig, + QString *errorMessage, + ProjectExplorer::RunMode runMode = ProjectExplorer::DebugRunMode); DEBUGGER_EXPORT bool fillParametersFromRunConfiguration(DebuggerStartParameters *sp, const ProjectExplorer::RunConfiguration *runConfig, diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index b36b10e8437..4ab295396a6 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -72,78 +72,49 @@ public: class DEBUGGER_EXPORT DebuggerStartParameters { public: - DebuggerStartParameters() - : masterEngineType(NoEngineType), - cppEngineType(NoEngineType), - runConfiguration(0), - attachPID(-1), - useTerminal(false), - breakOnMain(false), - continueAfterAttach(false), - multiProcess(false), - languages(AnyLanguage), - qmlServerAddress(QLatin1String("127.0.0.1")), - qmlServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT), - remoteSetupNeeded(false), - useContinueInsteadOfRun(false), - startMode(NoStartMode), - closeMode(KillAtClose), - useCtrlCStub(false), - skipExecutableValidation(false) - {} + DebuggerStartParameters() {} - DebuggerEngineType masterEngineType; - DebuggerEngineType cppEngineType; - QString sysRoot; - QString deviceSymbolsRoot; - QString debuggerCommand; - ProjectExplorer::Abi toolChainAbi; - QPointer runConfiguration; + DebuggerStartMode startMode = NoStartMode; + DebuggerCloseMode closeMode = KillAtClose; - QString platform; QString executable; QString displayName; // Used in the Snapshots view. QString processArgs; Utils::Environment environment; QString workingDirectory; - qint64 attachPID; - bool useTerminal; - bool breakOnMain; - bool continueAfterAttach; - bool multiProcess; - DebuggerLanguages languages; + qint64 attachPID = InvalidPid; + QStringList solibSearchPath; + bool useTerminal = false; // Used by Qml debugging. QString qmlServerAddress; quint16 qmlServerPort; - QString projectSourceDirectory; - QStringList additionalSearchDirectories; - QString projectBuildDirectory; - QStringList projectSourceFiles; - // Used by remote debugging. + // Used by general remote debugging. QString remoteChannel; QSsh::SshConnectionParameters connParams; - bool remoteSetupNeeded; + bool remoteSetupNeeded = false; // Used by baremetal plugin QByteArray commandsForReset; // commands used for resetting the inferior - bool useContinueInsteadOfRun; // if connected to a hw debugger run is not possible but continue is used + bool useContinueInsteadOfRun = false; // if connected to a hw debugger run is not possible but continue is used QByteArray commandsAfterConnect; // additional commands to post after connection to debug target // Used by Valgrind QVector expectedSignals; - QStringList solibSearchPath; - DebuggerStartMode startMode; - DebuggerCloseMode closeMode; - // For QNX debugging QString remoteExecutable; - bool useCtrlCStub; + bool useCtrlCStub = false; // Used by Android to avoid false positives on warnOnRelease - bool skipExecutableValidation; + bool skipExecutableValidation = false; + QStringList additionalSearchDirectories; + + // Used by iOS. + QString platform; + QString deviceSymbolsRoot; + bool continueAfterAttach = false; }; } // namespace Debugger diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 9f1bed9d6a0..617f087791c 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -58,11 +58,11 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &startParameters) - : GdbEngine(startParameters), m_startAttempted(false) +GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &runParameters) + : GdbEngine(runParameters), m_startAttempted(false) { if (HostOsInfo::isWindowsHost()) - m_gdbProc.setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry + m_gdbProc.setUseCtrlCStub(runParameters.useCtrlCStub); // This is only set for QNX/BlackBerry connect(&m_uploadProc, static_cast(&QProcess::error), this, &GdbRemoteServerEngine::uploadProcError); diff --git a/src/plugins/ios/iosdebugsupport.cpp b/src/plugins/ios/iosdebugsupport.cpp index 00708c64fd4..d6c2ebab011 100644 --- a/src/plugins/ios/iosdebugsupport.cpp +++ b/src/plugins/ios/iosdebugsupport.cpp @@ -77,8 +77,6 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi IDevice::ConstPtr device = DeviceKitInformation::device(target->kit()); if (device.isNull()) return 0; - QmakeProject *project = static_cast(target->project()); - Kit *kit = target->kit(); DebuggerStartParameters params; if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) { @@ -116,20 +114,12 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi } params.displayName = runConfig->applicationName(); params.remoteSetupNeeded = true; - if (!params.breakOnMain) - params.continueAfterAttach = true; - params.runConfiguration = runConfig; + params.continueAfterAttach = true; - DebuggerRunConfigurationAspect *aspect - = runConfig->extraAspect(); + auto aspect = runConfig->extraAspect(); bool cppDebug = aspect->useCppDebugger(); bool qmlDebug = aspect->useQmlDebugger(); if (cppDebug) { - params.languages |= CppLanguage; - params.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); - params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); - if (ToolChain *tc = ToolChainKitInformation::toolChain(kit)) - params.toolChainAbi = tc->targetAbi(); params.executable = runConfig->localExecutable().toString(); params.remoteChannel = QLatin1String("connect://localhost:0"); @@ -161,16 +151,11 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); } } - if (qmlDebug) { - params.languages |= QmlLanguage; - params.projectSourceDirectory = project->projectDirectory().toString(); - params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles); - params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir(); - if (!cppDebug) - params.startMode = AttachToRemoteServer; + if (qmlDebug && !cppDebug) { + params.startMode = AttachToRemoteServer; } - DebuggerRunControl * const debuggerRunControl = createDebuggerRunControl(params, errorMessage); + DebuggerRunControl *debuggerRunControl = createDebuggerRunControl(params, runConfig, errorMessage); if (debuggerRunControl) new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug); return debuggerRunControl; diff --git a/src/plugins/qnx/qnxattachdebugsupport.cpp b/src/plugins/qnx/qnxattachdebugsupport.cpp index 65f62f4e60d..dac8912da41 100644 --- a/src/plugins/qnx/qnxattachdebugsupport.cpp +++ b/src/plugins/qnx/qnxattachdebugsupport.cpp @@ -116,15 +116,10 @@ void QnxAttachDebugSupport::attachToProcess() sp.attachPID = m_process.pid; sp.startMode = Debugger::AttachToRemoteServer; sp.closeMode = Debugger::DetachAtClose; - sp.masterEngineType = Debugger::GdbEngineType; sp.connParams.port = m_pdebugPort; sp.remoteChannel = m_device->sshParameters().host + QLatin1Char(':') + QString::number(m_pdebugPort); sp.displayName = tr("Remote: \"%1:%2\" - Process %3").arg(sp.connParams.host).arg(m_pdebugPort).arg(m_process.pid); - sp.debuggerCommand = Debugger::DebuggerKitInformation::debuggerCommand(m_kit).toString(); - sp.projectSourceDirectory = m_projectSourceDirectory; sp.executable = m_localExecutablePath; - if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit)) - sp.toolChainAbi = tc->targetAbi(); sp.useCtrlCStub = true; QnxQtVersion *qtVersion = dynamic_cast(QtSupport::QtKitInformation::qtVersion(m_kit)); @@ -132,7 +127,7 @@ void QnxAttachDebugSupport::attachToProcess() sp.solibSearchPath = QnxUtils::searchPaths(qtVersion); QString errorMessage; - Debugger::DebuggerRunControl * const runControl = Debugger::createDebuggerRunControl(sp, &errorMessage); + Debugger::DebuggerRunControl *runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage); if (!errorMessage.isEmpty()) { handleError(errorMessage); stopPDebug(); diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp index 9a08cc545d6..2e943e0a1ba 100644 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ b/src/plugins/qnx/qnxruncontrolfactory.cpp @@ -73,14 +73,7 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration return params; params.startMode = AttachToRemoteServer; - params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString(); - params.sysRoot = SysRootKitInformation::sysRoot(k).toString(); params.useCtrlCStub = true; - params.runConfiguration = runConfig; - - if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) - params.toolChainAbi = tc->targetAbi(); - params.executable = runConfig->localExecutableFilePath(); params.remoteExecutable = runConfig->remoteExecutableFilePath(); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); @@ -89,26 +82,13 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration params.closeMode = KillAtClose; params.processArgs = runConfig->arguments().join(QLatin1Char(' ')); - DebuggerRunConfigurationAspect *aspect - = runConfig->extraAspect(); + auto aspect = runConfig->extraAspect(); if (aspect->useQmlDebugger()) { - params.languages |= QmlLanguage; params.qmlServerAddress = device->sshParameters().host; params.qmlServerPort = 0; // QML port is handed out later } - if (aspect->useCppDebugger()) - params.languages |= CppLanguage; - - if (const Project *project = runConfig->target()->project()) { - params.projectSourceDirectory = project->projectDirectory().toString(); - if (const BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration()) - params.projectBuildDirectory = buildConfig->buildDirectory().toString(); - params.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles); - } - - QnxQtVersion *qtVersion = - dynamic_cast(QtSupport::QtKitInformation::qtVersion(k)); + auto qtVersion = dynamic_cast(QtSupport::QtKitInformation::qtVersion(k)); if (qtVersion) params.solibSearchPath = QnxUtils::searchPaths(qtVersion); @@ -178,7 +158,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo return new QnxRunControl(rc); case DebugRunMode: { const DebuggerStartParameters params = createDebuggerStartParameters(rc); - DebuggerRunControl * const runControl = createDebuggerRunControl(params, errorMessage); + DebuggerRunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage); if (!runControl) return 0; diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index d785010dc58..769b0a2929e 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -87,42 +87,25 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractR const IDevice::ConstPtr device = DeviceKitInformation::device(k); QTC_ASSERT(device, return params); + params.startMode = AttachToRemoteServer; params.closeMode = KillAndExitMonitorAtClose; - params.sysRoot = SysRootKitInformation::sysRoot(k).toString(); - params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString(); - if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) - params.toolChainAbi = tc->targetAbi(); + params.remoteSetupNeeded = true; + params.displayName = runConfig->displayName(); - DebuggerRunConfigurationAspect *aspect - = runConfig->extraAspect(); + auto aspect = runConfig->extraAspect(); if (aspect->useQmlDebugger()) { - params.languages |= QmlLanguage; params.qmlServerAddress = device->sshParameters().host; params.qmlServerPort = 0; // port is selected later on } if (aspect->useCppDebugger()) { - params.multiProcess = true; - aspect->setUseMultiProcess(true); // TODO: One should suffice. - params.languages |= CppLanguage; + aspect->setUseMultiProcess(true); QStringList args = runConfig->arguments(); if (aspect->useQmlDebugger()) args.prepend(QString::fromLatin1("-qmljsdebugger=port:%qml_port%,block")); params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux); - params.startMode = AttachToRemoteServer; params.executable = runConfig->localExecutableFilePath(); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); params.remoteExecutable = runConfig->remoteExecutableFilePath(); - } else { - params.startMode = AttachToRemoteServer; - } - params.remoteSetupNeeded = true; - params.displayName = runConfig->displayName(); - - if (const Project *project = target->project()) { - params.projectSourceDirectory = project->projectDirectory().toString(); - if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration()) - params.projectBuildDirectory = buildConfig->buildDirectory().toString(); - params.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles); } return params; diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index 69a94478dc0..e933918b7d7 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -104,10 +104,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru } DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc); - if (mode == DebugRunModeWithBreakOnMain) - params.breakOnMain = true; - params.runConfiguration = runConfig; - DebuggerRunControl * const runControl = createDebuggerRunControl(params, errorMessage); + DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage); if (!runControl) return 0; LinuxDeviceDebugSupport * const debugSupport = diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index c11d307b0da..158006f724b 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -156,39 +156,17 @@ void MemcheckWithGdbRunControl::startDebugger() { const qint64 valgrindPid = runner()->valgrindProcess()->pid(); const AnalyzerStartParameters &mySp = startParameters(); + Debugger::DebuggerStartParameters sp; - - RunConfiguration *rc = runConfiguration(); - const Target *target = rc->target(); - QTC_ASSERT(target, return); - - const Kit *kit = target->kit(); - QTC_ASSERT(kit, return); - - if (const ToolChain *tc = ToolChainKitInformation::toolChain(kit)) - sp.toolChainAbi = tc->targetAbi(); - - if (const Project *project = target->project()) { - sp.projectSourceDirectory = project->projectDirectory().toString(); - sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles); - - if (const BuildConfiguration *bc = target->activeBuildConfiguration()) - sp.projectBuildDirectory = bc->buildDirectory().toString(); - } - sp.executable = mySp.debuggee; - sp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); - sp.debuggerCommand = Debugger::DebuggerKitInformation::debuggerCommand(kit).toString(); - sp.languages |= Debugger::CppLanguage; sp.startMode = Debugger::AttachToRemoteServer; sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid); sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid); sp.useContinueInsteadOfRun = true; - sp.expectedSignals << "SIGTRAP"; - sp.runConfiguration = rc; + sp.expectedSignals.append("SIGTRAP"); QString errorMessage; - RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, &errorMessage); + RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, runConfiguration(), &errorMessage); QTC_ASSERT(gdbRunControl, return); connect(gdbRunControl, &RunControl::finished, gdbRunControl, &RunControl::deleteLater); diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp index c81b94a4542..85b56b91c44 100644 --- a/src/plugins/winrt/winrtdebugsupport.cpp +++ b/src/plugins/winrt/winrtdebugsupport.cpp @@ -75,14 +75,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC using namespace Debugger; DebuggerStartParameters params; params.startMode = AttachExternal; - params.languages |= CppLanguage; - params.breakOnMain = mode == DebugRunModeWithBreakOnMain; // The first Thread needs to be resumed manually. params.commandsAfterConnect = "~0 m"; - Kit *kit = runConfig->target()->kit(); - params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); - if (ToolChain *tc = ToolChainKitInformation::toolChain(kit)) - params.toolChainAbi = tc->targetAbi(); QFileInfo debuggerHelper(QCoreApplication::applicationDirPath() + QLatin1String("/winrtdebughelper.exe")); @@ -125,9 +119,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC return 0; } server.close(); - params.runConfiguration = runConfig; Debugger::DebuggerRunControl *debugRunControl - = createDebuggerRunControl(params, errorMessage); + = createDebuggerRunControl(params, runConfig, errorMessage, mode); runner->setRunControl(debugRunControl); new WinRtDebugSupport(debugRunControl, runner); return debugRunControl;