forked from qt-creator/qt-creator
Debugger: Pass RunControl in DebuggerStartParameters
.. to simplify DebuggerRunControlFactory::doCreate() call. Change-Id: I4dd0c224968bb8a388ea7f095b940b66ee606ab1 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -89,6 +89,7 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
|
||||
params.startMode = AttachToRemoteServer;
|
||||
params.displayName = AndroidManager::packageName(target);
|
||||
params.remoteSetupNeeded = true;
|
||||
params.runConfiguration = runConfig;
|
||||
|
||||
DebuggerRunConfigurationAspect *aspect
|
||||
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
|
||||
@@ -119,7 +120,7 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
|
||||
}
|
||||
|
||||
DebuggerRunControl * const debuggerRunControl
|
||||
= DebuggerRunControlFactory::doCreate(params, runConfig, errorMessage);
|
||||
= DebuggerRunControlFactory::doCreate(params, errorMessage);
|
||||
new AndroidDebugSupport(runConfig, debuggerRunControl);
|
||||
return debuggerRunControl;
|
||||
}
|
||||
|
@@ -156,8 +156,8 @@ RunControl *BareMetalRunControlFactory::create(
|
||||
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
|
||||
sp.remoteSetupNeeded = true;
|
||||
|
||||
DebuggerRunControl *runControl =
|
||||
DebuggerRunControlFactory::doCreate(sp, rc, errorMessage);
|
||||
sp.runConfiguration = rc;
|
||||
DebuggerRunControl *runControl = DebuggerRunControlFactory::doCreate(sp, errorMessage);
|
||||
if (runControl && sp.remoteSetupNeeded) {
|
||||
const auto debugSupport = new BareMetalDebugSupport(dev, runControl);
|
||||
Q_UNUSED(debugSupport);
|
||||
|
@@ -378,11 +378,12 @@ RunControl *DebuggerRunControlFactory::create
|
||||
if (mode == DebugRunModeWithBreakOnMain)
|
||||
sp.breakOnMain = true;
|
||||
|
||||
return doCreate(sp, runConfiguration, errorMessage);
|
||||
sp.runConfiguration = runConfiguration;
|
||||
return doCreate(sp, errorMessage);
|
||||
}
|
||||
|
||||
DebuggerRunControl *DebuggerRunControlFactory::doCreate
|
||||
(const DebuggerStartParameters &sp0, RunConfiguration *rc, QString *errorMessage)
|
||||
(const DebuggerStartParameters &sp0, QString *errorMessage)
|
||||
{
|
||||
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
|
||||
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
|
||||
@@ -406,7 +407,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate
|
||||
if (sp.executable.endsWith(_(".py"))) {
|
||||
sp.masterEngineType = PdbEngineType;
|
||||
} else {
|
||||
if (rc) {
|
||||
if (RunConfiguration *rc = sp.runConfiguration) {
|
||||
DebuggerRunConfigurationAspect *aspect
|
||||
= rc->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
if (const Target *target = rc->target())
|
||||
@@ -438,7 +439,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate
|
||||
*errorMessage = error;
|
||||
return 0;
|
||||
}
|
||||
return new DebuggerRunControl(rc, engine);
|
||||
return new DebuggerRunControl(sp.runConfiguration, engine);
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *DebuggerRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
||||
@@ -449,7 +450,7 @@ IRunConfigurationAspect *DebuggerRunControlFactory::createRunConfigurationAspect
|
||||
DebuggerRunControl *DebuggerRunControlFactory::createAndScheduleRun(const DebuggerStartParameters &sp)
|
||||
{
|
||||
QString errorMessage;
|
||||
DebuggerRunControl *rc = doCreate(sp, 0, &errorMessage);
|
||||
DebuggerRunControl *rc = doCreate(sp, &errorMessage);
|
||||
if (!rc) {
|
||||
ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
|
||||
return 0;
|
||||
|
@@ -118,8 +118,7 @@ public:
|
||||
|
||||
static DebuggerRunControl *createAndScheduleRun(const DebuggerStartParameters &sp);
|
||||
|
||||
static DebuggerRunControl *doCreate(const DebuggerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *rc, QString *errorMessage);
|
||||
static DebuggerRunControl *doCreate(const DebuggerStartParameters &sp, QString *errorMessage);
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(
|
||||
ProjectExplorer::RunConfiguration *rc);
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <utils/environment.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
#include <QMetaType>
|
||||
@@ -82,6 +83,7 @@ public:
|
||||
firstSlaveEngineType(NoEngineType),
|
||||
secondSlaveEngineType(NoEngineType),
|
||||
cppEngineType(NoEngineType),
|
||||
runConfiguration(0),
|
||||
isSnapshot(false),
|
||||
attachPID(-1),
|
||||
useTerminal(false),
|
||||
@@ -112,6 +114,7 @@ public:
|
||||
QString debuggerCommand;
|
||||
ProjectExplorer::Abi toolChainAbi;
|
||||
ProjectExplorer::IDevice::ConstPtr device;
|
||||
QPointer<ProjectExplorer::RunConfiguration> runConfiguration;
|
||||
|
||||
QString platform;
|
||||
QString executable;
|
||||
|
@@ -118,6 +118,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
params.remoteSetupNeeded = true;
|
||||
if (!params.breakOnMain)
|
||||
params.continueAfterAttach = true;
|
||||
params.runConfiguration = runConfig;
|
||||
|
||||
DebuggerRunConfigurationAspect *aspect
|
||||
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
|
||||
@@ -170,7 +171,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
}
|
||||
|
||||
DebuggerRunControl * const debuggerRunControl
|
||||
= DebuggerRunControlFactory::doCreate(params, runConfig, errorMessage);
|
||||
= DebuggerRunControlFactory::doCreate(params, errorMessage);
|
||||
if (debuggerRunControl)
|
||||
new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug);
|
||||
return debuggerRunControl;
|
||||
|
@@ -114,6 +114,53 @@ static void createAnalyzerStartParameters(Analyzer::AnalyzerStartParameters *pSt
|
||||
pStartParameters->analyzerPort = aspect->qmlDebugServerPort();
|
||||
}
|
||||
|
||||
static Debugger::DebuggerStartParameters startParameters(BlackBerryRunConfiguration *runConfig)
|
||||
{
|
||||
Debugger::DebuggerStartParameters params;
|
||||
ProjectExplorer::Target *target = runConfig->target();
|
||||
ProjectExplorer::Kit *k = target->kit();
|
||||
|
||||
params.startMode = Debugger::AttachToRemoteServer;
|
||||
params.debuggerCommand = Debugger::DebuggerKitInformation::debuggerCommand(k).toString();
|
||||
params.sysRoot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toString();
|
||||
params.useCtrlCStub = true;
|
||||
params.runConfiguration = runConfig;
|
||||
|
||||
if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k))
|
||||
params.toolChainAbi = tc->targetAbi();
|
||||
|
||||
params.executable = runConfig->localExecutableFilePath();
|
||||
params.displayName = runConfig->displayName();
|
||||
params.remoteSetupNeeded = true;
|
||||
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
||||
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
if (aspect->useQmlDebugger()) {
|
||||
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->kit());
|
||||
if (device) {
|
||||
params.qmlServerAddress = device->sshParameters().host;
|
||||
params.qmlServerPort = aspect->qmlDebugServerPort();
|
||||
params.languages |= Debugger::QmlLanguage;
|
||||
}
|
||||
}
|
||||
if (aspect->useCppDebugger())
|
||||
params.languages |= Debugger::CppLanguage;
|
||||
|
||||
if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
|
||||
params.projectSourceDirectory = project->projectDirectory().toString();
|
||||
if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
||||
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
|
||||
params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
||||
}
|
||||
|
||||
BlackBerryQtVersion *qtVersion =
|
||||
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
|
||||
if (qtVersion)
|
||||
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode, QString *errorMessage)
|
||||
{
|
||||
@@ -161,7 +208,7 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
||||
return runControl;
|
||||
}
|
||||
Debugger::DebuggerRunControl * const runControl =
|
||||
Debugger::DebuggerRunControlFactory::doCreate(startParameters(rc), runConfiguration, errorMessage);
|
||||
Debugger::DebuggerRunControlFactory::doCreate(startParameters(rc), errorMessage);
|
||||
if (!runControl)
|
||||
return 0;
|
||||
|
||||
@@ -169,50 +216,3 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
||||
m_activeRunControls[rc->key()] = runControl;
|
||||
return runControl;
|
||||
}
|
||||
|
||||
Debugger::DebuggerStartParameters BlackBerryRunControlFactory::startParameters(
|
||||
const BlackBerryRunConfiguration *runConfig)
|
||||
{
|
||||
Debugger::DebuggerStartParameters params;
|
||||
ProjectExplorer::Target *target = runConfig->target();
|
||||
ProjectExplorer::Kit *k = target->kit();
|
||||
|
||||
params.startMode = Debugger::AttachToRemoteServer;
|
||||
params.debuggerCommand = Debugger::DebuggerKitInformation::debuggerCommand(k).toString();
|
||||
params.sysRoot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toString();
|
||||
params.useCtrlCStub = true;
|
||||
|
||||
if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k))
|
||||
params.toolChainAbi = tc->targetAbi();
|
||||
|
||||
params.executable = runConfig->localExecutableFilePath();
|
||||
params.displayName = runConfig->displayName();
|
||||
params.remoteSetupNeeded = true;
|
||||
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
||||
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
if (aspect->useQmlDebugger()) {
|
||||
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->kit());
|
||||
if (device) {
|
||||
params.qmlServerAddress = device->sshParameters().host;
|
||||
params.qmlServerPort = aspect->qmlDebugServerPort();
|
||||
params.languages |= Debugger::QmlLanguage;
|
||||
}
|
||||
}
|
||||
if (aspect->useCppDebugger())
|
||||
params.languages |= Debugger::CppLanguage;
|
||||
|
||||
if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
|
||||
params.projectSourceDirectory = project->projectDirectory().toString();
|
||||
if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
||||
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
|
||||
params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
||||
}
|
||||
|
||||
BlackBerryQtVersion *qtVersion =
|
||||
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
|
||||
if (qtVersion)
|
||||
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
@@ -58,8 +58,6 @@ public:
|
||||
QString *errorMessage);
|
||||
|
||||
private:
|
||||
static Debugger::DebuggerStartParameters startParameters( const BlackBerryRunConfiguration *runConfig);
|
||||
|
||||
mutable QMap<QString, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
|
||||
};
|
||||
|
||||
|
@@ -132,7 +132,7 @@ void QnxAttachDebugSupport::attachToProcess()
|
||||
sp.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
||||
|
||||
QString errorMessage;
|
||||
Debugger::DebuggerRunControl * const runControl = Debugger::DebuggerRunControlFactory::doCreate(sp, 0, &errorMessage);
|
||||
Debugger::DebuggerRunControl * const runControl = Debugger::DebuggerRunControlFactory::doCreate(sp, &errorMessage);
|
||||
if (!errorMessage.isEmpty()) {
|
||||
handleError(errorMessage);
|
||||
stopPDebug();
|
||||
|
@@ -62,7 +62,7 @@ using namespace ProjectExplorer;
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
static DebuggerStartParameters createDebuggerStartParameters(const QnxRunConfiguration *runConfig)
|
||||
static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration *runConfig)
|
||||
{
|
||||
DebuggerStartParameters params;
|
||||
Target *target = runConfig->target();
|
||||
@@ -76,6 +76,7 @@ static DebuggerStartParameters createDebuggerStartParameters(const QnxRunConfigu
|
||||
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();
|
||||
@@ -179,7 +180,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo
|
||||
return new QnxRunControl(rc);
|
||||
case DebugRunMode: {
|
||||
const DebuggerStartParameters params = createDebuggerStartParameters(rc);
|
||||
DebuggerRunControl * const runControl = DebuggerRunControlFactory::doCreate(params, rc, errorMessage);
|
||||
DebuggerRunControl * const runControl = DebuggerRunControlFactory::doCreate(params, errorMessage);
|
||||
if (!runControl)
|
||||
return 0;
|
||||
|
||||
|
@@ -106,8 +106,9 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
|
||||
DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc);
|
||||
if (mode == DebugRunModeWithBreakOnMain)
|
||||
params.breakOnMain = true;
|
||||
params.runConfiguration = rc;
|
||||
DebuggerRunControl * const runControl
|
||||
= DebuggerRunControlFactory::doCreate(params, rc, errorMessage);
|
||||
= DebuggerRunControlFactory::doCreate(params, errorMessage);
|
||||
if (!runControl)
|
||||
return 0;
|
||||
LinuxDeviceDebugSupport * const debugSupport =
|
||||
|
@@ -189,9 +189,10 @@ void MemcheckWithGdbRunControl::startDebugger()
|
||||
sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid);
|
||||
sp.useContinueInsteadOfRun = true;
|
||||
sp.expectedSignals << "SIGTRAP";
|
||||
sp.runConfiguration = rc;
|
||||
|
||||
QString errorMessage;
|
||||
RunControl *gdbRunControl = Debugger::DebuggerRunControlFactory::doCreate(sp, rc, &errorMessage);
|
||||
RunControl *gdbRunControl = Debugger::DebuggerRunControlFactory::doCreate(sp, &errorMessage);
|
||||
QTC_ASSERT(gdbRunControl, return);
|
||||
connect(gdbRunControl, &RunControl::finished,
|
||||
gdbRunControl, &RunControl::deleteLater);
|
||||
|
@@ -119,8 +119,9 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
|
||||
return 0;
|
||||
}
|
||||
server.close();
|
||||
params.runConfiguration = runConfig;
|
||||
Debugger::DebuggerRunControl *debugRunControl
|
||||
= DebuggerRunControlFactory::doCreate(params, runConfig, errorMessage);
|
||||
= DebuggerRunControlFactory::doCreate(params, errorMessage);
|
||||
runner->setRunControl(debugRunControl);
|
||||
new WinRtDebugSupport(debugRunControl, runner);
|
||||
return debugRunControl;
|
||||
|
Reference in New Issue
Block a user