Commit 1538dca8 authored by hjk's avatar hjk

Debugger: Continue DebuggerStartParameter cleanup

- Move sysRoot, debuggerCommand, targetAbi to DebuggerRunParameters,
  they are always the one coming from the kit.
- Move projectSource{Directory,Files} to DebuggerRunParameters,
  they are alway coming from the runConfiguration's project
- Pass RunConfiguration always as separate parameter, that's
  what related code does.

Change-Id: I9965a052237af53fa2d170701bc88b552cab12ed
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent f84169b5
......@@ -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<DebuggerRunConfigurationAspect>();
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
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;
}
......
......@@ -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)) {
......
......@@ -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<const BareMetalGdbCommandsDeployStep *>(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<const BareMetalGdbCommandsDeployStep *>(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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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<const LocalApplicationRunConfiguration *>(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<EnvironmentAspect>();
if (envAspect)
if (auto envAspect = m_runConfig->extraAspect<EnvironmentAspect>())
m_rp.environment = envAspect->environment();
}
if (m_runConfig)
m_debuggerAspect = m_runConfig->extraAspect<DebuggerRunConfigurationAspect>();
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<Task> 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<DebuggerRunConfigurationAspect>();
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;
......
......@@ -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,
......
......@@ -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<ProjectExplorer::RunConfiguration> 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<QByteArray> 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
......
......@@ -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<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
this, &GdbRemoteServerEngine::uploadProcError);
......
......@@ -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<QmakeProject *>(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<DebuggerRunConfigurationAspect>();
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
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;
......
......@@ -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<QnxQtVersion *>(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();
......
......@@ -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<DebuggerRunConfigurationAspect>();
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
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<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
auto qtVersion = dynamic_cast<QnxQtVersion *>(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;
......
......@@ -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<DebuggerRunConfigurationAspect>();
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
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;
......
......@@ -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 =
......
......@@ -156,39 +156,17 @@ void MemcheckWithGdbRunControl::startDebugger()
{
const qint64 valgrindPid = runner()->valgrindProcess()->pid();
const AnalyzerStartParameters &mySp = startParameters();
Debugger::DebuggerStartParameters sp;
RunConfiguration *rc = runConfiguration();