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: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
hjk
2015-06-26 13:06:08 +02:00
parent f84169b51e
commit 1538dca81a
16 changed files with 90 additions and 225 deletions

View File

@@ -89,17 +89,10 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.startMode = AttachToRemoteServer; params.startMode = AttachToRemoteServer;
params.displayName = AndroidManager::packageName(target); params.displayName = AndroidManager::packageName(target);
params.remoteSetupNeeded = true; params.remoteSetupNeeded = true;
params.runConfiguration = runConfig;
DebuggerRunConfigurationAspect *aspect auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useCppDebugger()) { if (aspect->useCppDebugger()) {
params.languages |= CppLanguage;
Kit *kit = target->kit(); 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.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process");
params.skipExecutableValidation = true; params.skipExecutableValidation = true;
params.remoteChannel = runConfig->remoteChannel(); params.remoteChannel = runConfig->remoteChannel();
@@ -108,25 +101,20 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.solibSearchPath.append(qtSoPaths(version)); params.solibSearchPath.append(qtSoPaths(version));
} }
if (aspect->useQmlDebugger()) { if (aspect->useQmlDebugger()) {
params.languages |= QmlLanguage;
QTcpServer server; QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost) QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6), return 0); || server.listen(QHostAddress::LocalHostIPv6), return 0);
params.qmlServerAddress = server.serverAddress().toString(); params.qmlServerAddress = server.serverAddress().toString();
params.remoteSetupNeeded = true;
//TODO: Not sure if these are the right paths. //TODO: Not sure if these are the right paths.
params.projectSourceDirectory = target->project()->projectDirectory().toString();
Kit *kit = target->kit(); Kit *kit = target->kit();
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
if (version) { if (version) {
const QString qmlQtDir = version->versionInfo().value(QLatin1String("QT_INSTALL_QML")); const QString qmlQtDir = version->versionInfo().value(QLatin1String("QT_INSTALL_QML"));
params.additionalSearchDirectories = QStringList(qmlQtDir); 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); new AndroidDebugSupport(runConfig, debuggerRunControl);
return debuggerRunControl; return debuggerRunControl;
} }

View File

@@ -543,7 +543,7 @@ void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bo
QString pidString = QString::number(m_processPID); QString pidString = QString::number(m_processPID);
foreach (const QByteArray &msg, lines) { 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)) if (!line.contains(pidString))
continue; continue;
if (m_logCatRegExp.exactMatch(line)) { if (m_logCatRegExp.exactMatch(line)) {

View File

@@ -119,19 +119,10 @@ RunControl *BareMetalRunControlFactory::create(
DebuggerStartParameters sp; 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()) { if (const BuildConfiguration *bc = target->activeBuildConfiguration()) {
sp.projectBuildDirectory = bc->buildDirectory().toString();
if (const BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId())) { if (const BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId())) {
foreach (const BuildStep *bs, bsl->steps()) { foreach (const BuildStep *bs, bsl->steps()) {
const auto ds = qobject_cast<const BareMetalGdbCommandsDeployStep *>(bs); if (auto ds = qobject_cast<const BareMetalGdbCommandsDeployStep *>(bs)) {
if (ds) {
if (!sp.commandsAfterConnect.endsWith("\n")) if (!sp.commandsAfterConnect.endsWith("\n"))
sp.commandsAfterConnect.append("\n"); sp.commandsAfterConnect.append("\n");
sp.commandsAfterConnect.append(ds->gdbCommands().toLatin1()); sp.commandsAfterConnect.append(ds->gdbCommands().toLatin1());
@@ -139,12 +130,8 @@ RunControl *BareMetalRunControlFactory::create(
} }
} }
} }
}
sp.executable = bin; sp.executable = bin;
sp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
sp.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString();
sp.languages |= CppLanguage;
sp.processArgs = rc->arguments(); sp.processArgs = rc->arguments();
sp.startMode = AttachToRemoteServer; sp.startMode = AttachToRemoteServer;
sp.displayName = rc->displayName(); sp.displayName = rc->displayName();
@@ -156,8 +143,7 @@ RunControl *BareMetalRunControlFactory::create(
if (p->startupMode() == GdbServerProvider::StartupOnNetwork) if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
sp.remoteSetupNeeded = true; sp.remoteSetupNeeded = true;
sp.runConfiguration = rc; DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage);
DebuggerRunControl *runControl = createDebuggerRunControl(sp, errorMessage);
if (runControl && sp.remoteSetupNeeded) { if (runControl && sp.remoteSetupNeeded) {
const auto debugSupport = new BareMetalDebugSupport(dev, runControl); const auto debugSupport = new BareMetalDebugSupport(dev, runControl);
Q_UNUSED(debugSupport); Q_UNUSED(debugSupport);

View File

@@ -85,6 +85,14 @@ class DebuggerRunParameters : public DebuggerStartParameters
public: public:
DebuggerRunParameters() {} 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 coreFile;
QString overrideStartScript; // Used in attach to core and remote debugging QString overrideStartScript; // Used in attach to core and remote debugging
QString startMessage; // First status message shown. QString startMessage; // First status message shown.
@@ -93,7 +101,12 @@ public:
QStringList debugSourceLocation; // Gdb "directory" QStringList debugSourceLocation; // Gdb "directory"
QString serverStartScript; QString serverStartScript;
ProjectExplorer::IDevice::ConstPtr device; ProjectExplorer::IDevice::ConstPtr device;
QString sysRoot;
bool isSnapshot = false; // Set if created internally. bool isSnapshot = false; // Set if created internally.
ProjectExplorer::Abi toolChainAbi;
QString projectSourceDirectory;
QStringList projectSourceFiles;
// Used by AttachCrashedExternal. // Used by AttachCrashedExternal.
QString crashParameter; QString crashParameter;

View File

@@ -2290,19 +2290,14 @@ static QString formatStartParameters(DebuggerRunParameters &sp)
str << "PID: " << sp.attachPID << ' ' << sp.crashParameter << '\n'; str << "PID: " << sp.attachPID << ' ' << sp.crashParameter << '\n';
if (!sp.projectSourceDirectory.isEmpty()) { if (!sp.projectSourceDirectory.isEmpty()) {
str << "Project: " << QDir::toNativeSeparators(sp.projectSourceDirectory); str << "Project: " << QDir::toNativeSeparators(sp.projectSourceDirectory);
if (!sp.projectBuildDirectory.isEmpty())
str << " (built: " << QDir::toNativeSeparators(sp.projectBuildDirectory)
<< ')';
str << '\n';
str << "Addtional Search Directories:" str << "Addtional Search Directories:"
<< sp.additionalSearchDirectories.join(QLatin1Char(' ')) << '\n'; << sp.additionalSearchDirectories.join(QLatin1Char(' ')) << '\n';
} }
if (!sp.qmlServerAddress.isEmpty()) if (!sp.qmlServerAddress.isEmpty())
str << "QML server: " << sp.qmlServerAddress << ':' str << "QML server: " << sp.qmlServerAddress << ':'
<< sp.qmlServerPort << '\n'; << sp.qmlServerPort << '\n';
if (!sp.remoteChannel.isEmpty()) { if (!sp.remoteChannel.isEmpty())
str << "Remote: " << sp.remoteChannel << '\n'; str << "Remote: " << sp.remoteChannel << '\n';
}
str << "Sysroot: " << sp.sysRoot << '\n'; str << "Sysroot: " << sp.sysRoot << '\n';
str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1Char(':')) << '\n'; str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1Char(':')) << '\n';
return rc; return rc;

View File

@@ -295,7 +295,7 @@ public:
// detectable pieces, construct an Engine and a RunControl. // detectable pieces, construct an Engine and a RunControl.
void initialize(const DebuggerStartParameters &sp); void initialize(const DebuggerStartParameters &sp);
void enrich(const RunConfiguration *runConfig, const Kit *kit); 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')); } QString fullError() const { return m_errors.join(QLatin1Char('\n')); }
// Result. // Result.
@@ -326,9 +326,6 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (!m_runConfig) if (!m_runConfig)
m_runConfig = runConfig; m_runConfig = runConfig;
if (!m_runConfig)
m_runConfig = m_rp.runConfiguration;
// Extract as much as possible from available RunConfiguration. // Extract as much as possible from available RunConfiguration.
if (auto localRc = qobject_cast<const LocalApplicationRunConfiguration *>(m_runConfig)) { if (auto localRc = qobject_cast<const LocalApplicationRunConfiguration *>(m_runConfig)) {
m_rp.executable = localRc->executable(); m_rp.executable = localRc->executable();
@@ -398,17 +395,22 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
} }
if (m_runConfig) { if (m_runConfig) {
auto envAspect = m_runConfig->extraAspect<EnvironmentAspect>(); if (auto envAspect = m_runConfig->extraAspect<EnvironmentAspect>())
if (envAspect)
m_rp.environment = envAspect->environment(); m_rp.environment = envAspect->environment();
} }
if (m_runConfig) if (ToolChain *tc = ToolChainKitInformation::toolChain(m_kit))
m_debuggerAspect = m_runConfig->extraAspect<DebuggerRunConfigurationAspect>(); m_rp.toolChainAbi = tc->targetAbi();
if (m_target) if (m_target)
m_project = m_target->project(); 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 // validate debugger if C++ debugging is enabled
if (m_rp.languages & CppLanguage) { if (m_rp.languages & CppLanguage) {
const QList<Task> tasks = DebuggerKitInformation::validateDebugger(m_kit); 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.cppEngineType = DebuggerKitInformation::engineType(m_kit);
m_rp.sysRoot = SysRootKitInformation::sysRoot(m_kit).toString(); m_rp.sysRoot = SysRootKitInformation::sysRoot(m_kit).toString();
m_rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(m_kit).toString(); m_rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(m_kit).toString();
m_rp.device = DeviceKitInformation::device(m_kit);
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();
}
if (m_project) { if (m_project) {
m_rp.projectSourceDirectory = m_project->projectDirectory().toString(); m_rp.projectSourceDirectory = m_project->projectDirectory().toString();
m_rp.projectSourceFiles = m_project->files(Project::ExcludeGeneratedFiles); 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) { if (m_debuggerAspect) {
m_rp.multiProcess = m_debuggerAspect->useMultiProcess(); m_rp.multiProcess = m_debuggerAspect->useMultiProcess();
@@ -446,6 +441,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
m_rp.languages |= CppLanguage; m_rp.languages |= CppLanguage;
if (m_debuggerAspect->useQmlDebugger()) { if (m_debuggerAspect->useQmlDebugger()) {
m_rp.languages |= QmlLanguage;
if (m_rp.device && m_rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { if (m_rp.device && m_rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
QTcpServer server; QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost) 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.qmlServerAddress = server.serverAddress().toString();
m_rp.qmlServerPort = server.serverPort(); m_rp.qmlServerPort = server.serverPort();
m_rp.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!
@@ -495,6 +490,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (m_rp.masterEngineType == NoEngineType && m_debuggerAspect) { if (m_rp.masterEngineType == NoEngineType && m_debuggerAspect) {
const bool useCppDebugger = m_debuggerAspect->useCppDebugger() && (m_rp.languages & CppLanguage); const bool useCppDebugger = m_debuggerAspect->useCppDebugger() && (m_rp.languages & CppLanguage);
const bool useQmlDebugger = m_debuggerAspect->useQmlDebugger() && (m_rp.languages & QmlLanguage); const bool useQmlDebugger = m_debuggerAspect->useQmlDebugger() && (m_rp.languages & QmlLanguage);
if (useQmlDebugger) { if (useQmlDebugger) {
if (useCppDebugger) if (useCppDebugger)
m_rp.masterEngineType = QmlCppEngineType; m_rp.masterEngineType = QmlCppEngineType;
@@ -619,7 +615,7 @@ DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const
DebuggerRunControlCreator creator; DebuggerRunControlCreator creator;
creator.m_rp = rp; creator.m_rp = rp;
creator.enrich(0, kit); creator.enrich(0, kit);
creator.createRunControl(); creator.createRunControl(DebugRunMode);
if (!creator.m_runControl) { if (!creator.m_runControl) {
ProjectExplorerPlugin::showRunErrorMessage(creator.fullError()); ProjectExplorerPlugin::showRunErrorMessage(creator.fullError());
return 0; return 0;
@@ -634,12 +630,15 @@ DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const
/** /**
* Main entry point for target plugins. * 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; DebuggerRunControlCreator creator;
creator.initialize(sp); creator.initialize(sp);
creator.enrich(sp.runConfiguration, 0); creator.enrich(runConfig, 0);
creator.createRunControl(); creator.createRunControl(runMode);
if (errorMessage) if (errorMessage)
*errorMessage = creator.fullError(); *errorMessage = creator.fullError();
if (!creator.m_runControl) { if (!creator.m_runControl) {
@@ -658,7 +657,7 @@ bool fillParametersFromRunConfiguration(DebuggerStartParameters *sp, const RunCo
DebuggerRunControlCreator creator; DebuggerRunControlCreator creator;
creator.initialize(*sp); creator.initialize(*sp);
creator.enrich(runConfig, 0); creator.enrich(runConfig, 0);
creator.createRunControl(); creator.createRunControl(DebugRunMode);
if (errorMessage) if (errorMessage)
*errorMessage = creator.fullError(); *errorMessage = creator.fullError();
*sp = creator.m_rp; *sp = creator.m_rp;

View File

@@ -48,7 +48,9 @@ class DebuggerRunControlCreator;
} }
DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, 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, DEBUGGER_EXPORT bool fillParametersFromRunConfiguration(DebuggerStartParameters *sp,
const ProjectExplorer::RunConfiguration *runConfig, const ProjectExplorer::RunConfiguration *runConfig,

View File

@@ -72,78 +72,49 @@ public:
class DEBUGGER_EXPORT DebuggerStartParameters class DEBUGGER_EXPORT DebuggerStartParameters
{ {
public: public:
DebuggerStartParameters() 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)
{}
DebuggerEngineType masterEngineType; DebuggerStartMode startMode = NoStartMode;
DebuggerEngineType cppEngineType; DebuggerCloseMode closeMode = KillAtClose;
QString sysRoot;
QString deviceSymbolsRoot;
QString debuggerCommand;
ProjectExplorer::Abi toolChainAbi;
QPointer<ProjectExplorer::RunConfiguration> runConfiguration;
QString platform;
QString executable; QString executable;
QString displayName; // Used in the Snapshots view. QString displayName; // Used in the Snapshots view.
QString processArgs; QString processArgs;
Utils::Environment environment; Utils::Environment environment;
QString workingDirectory; QString workingDirectory;
qint64 attachPID; qint64 attachPID = InvalidPid;
bool useTerminal; QStringList solibSearchPath;
bool breakOnMain; bool useTerminal = false;
bool continueAfterAttach;
bool multiProcess;
DebuggerLanguages languages;
// Used by Qml debugging. // Used by Qml debugging.
QString qmlServerAddress; QString qmlServerAddress;
quint16 qmlServerPort; quint16 qmlServerPort;
QString projectSourceDirectory;
QStringList additionalSearchDirectories;
QString projectBuildDirectory;
QStringList projectSourceFiles;
// Used by remote debugging. // Used by general remote debugging.
QString remoteChannel; QString remoteChannel;
QSsh::SshConnectionParameters connParams; QSsh::SshConnectionParameters connParams;
bool remoteSetupNeeded; bool remoteSetupNeeded = false;
// Used by baremetal plugin // Used by baremetal plugin
QByteArray commandsForReset; // commands used for resetting the inferior 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 QByteArray commandsAfterConnect; // additional commands to post after connection to debug target
// Used by Valgrind // Used by Valgrind
QVector<QByteArray> expectedSignals; QVector<QByteArray> expectedSignals;
QStringList solibSearchPath;
DebuggerStartMode startMode;
DebuggerCloseMode closeMode;
// For QNX debugging // For QNX debugging
QString remoteExecutable; QString remoteExecutable;
bool useCtrlCStub; bool useCtrlCStub = false;
// Used by Android to avoid false positives on warnOnRelease // 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 } // namespace Debugger

View File

@@ -58,11 +58,11 @@ namespace Internal {
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &startParameters) GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &runParameters)
: GdbEngine(startParameters), m_startAttempted(false) : GdbEngine(runParameters), m_startAttempted(false)
{ {
if (HostOsInfo::isWindowsHost()) 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), connect(&m_uploadProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
this, &GdbRemoteServerEngine::uploadProcError); this, &GdbRemoteServerEngine::uploadProcError);

View File

@@ -77,8 +77,6 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
IDevice::ConstPtr device = DeviceKitInformation::device(target->kit()); IDevice::ConstPtr device = DeviceKitInformation::device(target->kit());
if (device.isNull()) if (device.isNull())
return 0; return 0;
QmakeProject *project = static_cast<QmakeProject *>(target->project());
Kit *kit = target->kit();
DebuggerStartParameters params; DebuggerStartParameters params;
if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) { if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) {
@@ -116,20 +114,12 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
} }
params.displayName = runConfig->applicationName(); params.displayName = runConfig->applicationName();
params.remoteSetupNeeded = true; params.remoteSetupNeeded = true;
if (!params.breakOnMain)
params.continueAfterAttach = true; params.continueAfterAttach = true;
params.runConfiguration = runConfig;
DebuggerRunConfigurationAspect *aspect auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
bool cppDebug = aspect->useCppDebugger(); bool cppDebug = aspect->useCppDebugger();
bool qmlDebug = aspect->useQmlDebugger(); bool qmlDebug = aspect->useQmlDebugger();
if (cppDebug) { 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.executable = runConfig->localExecutable().toString();
params.remoteChannel = QLatin1String("connect://localhost:0"); params.remoteChannel = QLatin1String("connect://localhost:0");
@@ -161,16 +151,11 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
} }
} }
if (qmlDebug) { if (qmlDebug && !cppDebug) {
params.languages |= QmlLanguage;
params.projectSourceDirectory = project->projectDirectory().toString();
params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles);
params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir();
if (!cppDebug)
params.startMode = AttachToRemoteServer; params.startMode = AttachToRemoteServer;
} }
DebuggerRunControl * const debuggerRunControl = createDebuggerRunControl(params, errorMessage); DebuggerRunControl *debuggerRunControl = createDebuggerRunControl(params, runConfig, errorMessage);
if (debuggerRunControl) if (debuggerRunControl)
new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug); new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug);
return debuggerRunControl; return debuggerRunControl;

View File

@@ -116,15 +116,10 @@ void QnxAttachDebugSupport::attachToProcess()
sp.attachPID = m_process.pid; sp.attachPID = m_process.pid;
sp.startMode = Debugger::AttachToRemoteServer; sp.startMode = Debugger::AttachToRemoteServer;
sp.closeMode = Debugger::DetachAtClose; sp.closeMode = Debugger::DetachAtClose;
sp.masterEngineType = Debugger::GdbEngineType;
sp.connParams.port = m_pdebugPort; sp.connParams.port = m_pdebugPort;
sp.remoteChannel = m_device->sshParameters().host + QLatin1Char(':') + QString::number(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.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; sp.executable = m_localExecutablePath;
if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit))
sp.toolChainAbi = tc->targetAbi();
sp.useCtrlCStub = true; sp.useCtrlCStub = true;
QnxQtVersion *qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(m_kit)); QnxQtVersion *qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(m_kit));
@@ -132,7 +127,7 @@ void QnxAttachDebugSupport::attachToProcess()
sp.solibSearchPath = QnxUtils::searchPaths(qtVersion); sp.solibSearchPath = QnxUtils::searchPaths(qtVersion);
QString errorMessage; QString errorMessage;
Debugger::DebuggerRunControl * const runControl = Debugger::createDebuggerRunControl(sp, &errorMessage); Debugger::DebuggerRunControl *runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage);
if (!errorMessage.isEmpty()) { if (!errorMessage.isEmpty()) {
handleError(errorMessage); handleError(errorMessage);
stopPDebug(); stopPDebug();

View File

@@ -73,14 +73,7 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
return params; return params;
params.startMode = AttachToRemoteServer; params.startMode = AttachToRemoteServer;
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString();
params.sysRoot = SysRootKitInformation::sysRoot(k).toString();
params.useCtrlCStub = true; params.useCtrlCStub = true;
params.runConfiguration = runConfig;
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
params.toolChainAbi = tc->targetAbi();
params.executable = runConfig->localExecutableFilePath(); params.executable = runConfig->localExecutableFilePath();
params.remoteExecutable = runConfig->remoteExecutableFilePath(); params.remoteExecutable = runConfig->remoteExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
@@ -89,26 +82,13 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
params.closeMode = KillAtClose; params.closeMode = KillAtClose;
params.processArgs = runConfig->arguments().join(QLatin1Char(' ')); params.processArgs = runConfig->arguments().join(QLatin1Char(' '));
DebuggerRunConfigurationAspect *aspect auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) { if (aspect->useQmlDebugger()) {
params.languages |= QmlLanguage;
params.qmlServerAddress = device->sshParameters().host; params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = 0; // QML port is handed out later params.qmlServerPort = 0; // QML port is handed out later
} }
if (aspect->useCppDebugger()) auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
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));
if (qtVersion) if (qtVersion)
params.solibSearchPath = QnxUtils::searchPaths(qtVersion); params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
@@ -178,7 +158,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo
return new QnxRunControl(rc); return new QnxRunControl(rc);
case DebugRunMode: { case DebugRunMode: {
const DebuggerStartParameters params = createDebuggerStartParameters(rc); const DebuggerStartParameters params = createDebuggerStartParameters(rc);
DebuggerRunControl * const runControl = createDebuggerRunControl(params, errorMessage); DebuggerRunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
if (!runControl) if (!runControl)
return 0; return 0;

View File

@@ -87,42 +87,25 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractR
const IDevice::ConstPtr device = DeviceKitInformation::device(k); const IDevice::ConstPtr device = DeviceKitInformation::device(k);
QTC_ASSERT(device, return params); QTC_ASSERT(device, return params);
params.startMode = AttachToRemoteServer;
params.closeMode = KillAndExitMonitorAtClose; params.closeMode = KillAndExitMonitorAtClose;
params.sysRoot = SysRootKitInformation::sysRoot(k).toString(); params.remoteSetupNeeded = true;
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString(); params.displayName = runConfig->displayName();
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
params.toolChainAbi = tc->targetAbi();
DebuggerRunConfigurationAspect *aspect auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) { if (aspect->useQmlDebugger()) {
params.languages |= QmlLanguage;
params.qmlServerAddress = device->sshParameters().host; params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = 0; // port is selected later on params.qmlServerPort = 0; // port is selected later on
} }
if (aspect->useCppDebugger()) { if (aspect->useCppDebugger()) {
params.multiProcess = true; aspect->setUseMultiProcess(true);
aspect->setUseMultiProcess(true); // TODO: One should suffice.
params.languages |= CppLanguage;
QStringList args = runConfig->arguments(); QStringList args = runConfig->arguments();
if (aspect->useQmlDebugger()) if (aspect->useQmlDebugger())
args.prepend(QString::fromLatin1("-qmljsdebugger=port:%qml_port%,block")); args.prepend(QString::fromLatin1("-qmljsdebugger=port:%qml_port%,block"));
params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux); params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux);
params.startMode = AttachToRemoteServer;
params.executable = runConfig->localExecutableFilePath(); params.executable = runConfig->localExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.remoteExecutable = runConfig->remoteExecutableFilePath(); 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; return params;

View File

@@ -104,10 +104,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
} }
DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc); DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc);
if (mode == DebugRunModeWithBreakOnMain) DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage);
params.breakOnMain = true;
params.runConfiguration = runConfig;
DebuggerRunControl * const runControl = createDebuggerRunControl(params, errorMessage);
if (!runControl) if (!runControl)
return 0; return 0;
LinuxDeviceDebugSupport * const debugSupport = LinuxDeviceDebugSupport * const debugSupport =

View File

@@ -156,39 +156,17 @@ void MemcheckWithGdbRunControl::startDebugger()
{ {
const qint64 valgrindPid = runner()->valgrindProcess()->pid(); const qint64 valgrindPid = runner()->valgrindProcess()->pid();
const AnalyzerStartParameters &mySp = startParameters(); const AnalyzerStartParameters &mySp = startParameters();
Debugger::DebuggerStartParameters sp; 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.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.startMode = Debugger::AttachToRemoteServer;
sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid); sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid);
sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid); sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid);
sp.useContinueInsteadOfRun = true; sp.useContinueInsteadOfRun = true;
sp.expectedSignals << "SIGTRAP"; sp.expectedSignals.append("SIGTRAP");
sp.runConfiguration = rc;
QString errorMessage; QString errorMessage;
RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, &errorMessage); RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, runConfiguration(), &errorMessage);
QTC_ASSERT(gdbRunControl, return); QTC_ASSERT(gdbRunControl, return);
connect(gdbRunControl, &RunControl::finished, connect(gdbRunControl, &RunControl::finished,
gdbRunControl, &RunControl::deleteLater); gdbRunControl, &RunControl::deleteLater);

View File

@@ -75,14 +75,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
using namespace Debugger; using namespace Debugger;
DebuggerStartParameters params; DebuggerStartParameters params;
params.startMode = AttachExternal; params.startMode = AttachExternal;
params.languages |= CppLanguage;
params.breakOnMain = mode == DebugRunModeWithBreakOnMain;
// The first Thread needs to be resumed manually. // The first Thread needs to be resumed manually.
params.commandsAfterConnect = "~0 m"; 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() QFileInfo debuggerHelper(QCoreApplication::applicationDirPath()
+ QLatin1String("/winrtdebughelper.exe")); + QLatin1String("/winrtdebughelper.exe"));
@@ -125,9 +119,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
return 0; return 0;
} }
server.close(); server.close();
params.runConfiguration = runConfig;
Debugger::DebuggerRunControl *debugRunControl Debugger::DebuggerRunControl *debugRunControl
= createDebuggerRunControl(params, errorMessage); = createDebuggerRunControl(params, runConfig, errorMessage, mode);
runner->setRunControl(debugRunControl); runner->setRunControl(debugRunControl);
new WinRtDebugSupport(debugRunControl, runner); new WinRtDebugSupport(debugRunControl, runner);
return debugRunControl; return debugRunControl;