aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-05-09 14:37:02 +0200
committerhjk <hjk@qt.io>2018-05-11 07:56:33 +0000
commit3cfc715d7d33b724ad896c540af4a914d922e9bc (patch)
treee837018161278300c1928130ffecaaaca05897bc
parent2c5e8e8d64862966d90586a0c7120225d7831567 (diff)
Debugger: Try harder to find a usable device
In remote setups without proper run configuration (e.g. attach using the menu) there was no device available. In some situation there's access to a kit, though, containing the right device. Use it. Task-number: QTCREATORBUG-20331 Change-Id: I54523f71fc10c9959901f36f3d62872d139279e5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp11
-rw-r--r--src/plugins/projectexplorer/runconfiguration.cpp6
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h1
3 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index b58a226b09..851bebac8c 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1188,7 +1188,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
if (!kit)
kit = guessKitFromAbis(Abi::abisOfBinary(FileName::fromString(executable)));
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(kit);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, kit);
debugger->setInferiorExecutable(executable);
if (pid) {
@@ -1960,7 +1961,8 @@ void DebuggerPluginPrivate::attachCore()
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(dlg.kit());
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, dlg.kit());
debugger->setInferiorExecutable(dlg.localExecutableFile());
debugger->setCoreFileName(dlg.localCoreFile());
@@ -1987,7 +1989,8 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
return;
setConfigValue(connectionKey, dlg.connection());
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(kit);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, kit);
debugger->setStartMode(AttachToRemoteServer);
debugger->setCloseMode(KillAtClose);
@@ -2045,7 +2048,7 @@ void DebuggerPluginPrivate::attachToRunningApplication()
if (device->type() == PE::DESKTOP_DEVICE_TYPE) {
attachToRunningProcess(kit, process, false);
} else {
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new RemoteAttachRunner(runControl, kit, process.pid);
debugger->startRunControl();
}
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index b13f267fd0..3caf3916ba 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -884,6 +884,12 @@ RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
#endif
}
+RunControl::RunControl(const IDevice::ConstPtr &device, Core::Id mode)
+ : RunControl(nullptr, mode)
+{
+ d->device = device;
+}
+
RunControl::~RunControl()
{
#ifdef WITH_JOURNALD
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index e7e0c4aa73..aba94da1aa 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -431,6 +431,7 @@ class PROJECTEXPLORER_EXPORT RunControl : public QObject
public:
RunControl(RunConfiguration *runConfiguration, Core::Id mode);
+ RunControl(const IDevice::ConstPtr &device, Core::Id mode);
~RunControl() override;
void initiateStart();