forked from qt-creator/qt-creator
RunWorker: Drop device() indirection
To clear RunWorker's API. It's RunControl's data. Task-number: QTCREATORBUG-29168 Change-Id: I94367544bb76c9886bda97f3a47727e0a8777310 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -39,7 +39,7 @@ public:
|
||||
explicit BareMetalDebugSupport(RunControl *runControl)
|
||||
: Debugger::DebuggerRunTool(runControl)
|
||||
{
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(runControl->device());
|
||||
if (!dev) {
|
||||
reportFailure(Tr::tr("Cannot debug: Kit has no device."));
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
private:
|
||||
void start() final
|
||||
{
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(runControl()->device());
|
||||
QTC_ASSERT(dev, reportFailure(); return);
|
||||
IDebugServerProvider *p = DebugServerProviderManager::findProvider(
|
||||
dev->debugServerProviderId());
|
||||
|
@@ -33,7 +33,7 @@ static RunWorker *createQdbDeviceInferiorWorker(RunControl *runControl,
|
||||
worker->setId("QdbDeviceInferiorWorker");
|
||||
|
||||
worker->setStartModifier([worker, runControl, qmlServices] {
|
||||
CommandLine cmd{worker->device()->filePath(Constants::AppcontrollerFilepath)};
|
||||
CommandLine cmd{runControl->device()->filePath(Constants::AppcontrollerFilepath)};
|
||||
|
||||
int lowerPort = 0;
|
||||
int upperPort = 0;
|
||||
|
@@ -1296,7 +1296,7 @@ void DebuggerEngine::setRunId(const QString &id)
|
||||
void DebuggerEngine::setRunTool(DebuggerRunTool *runTool)
|
||||
{
|
||||
d->m_runTool = runTool;
|
||||
d->m_device = runTool->device();
|
||||
d->m_device = runTool->runControl()->device();
|
||||
|
||||
validateRunParameters(d->m_runParameters);
|
||||
|
||||
|
@@ -578,11 +578,11 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
cmd.addArg(qmlDebugTcpArguments(QmlDebuggerServices, runControl()->qmlChannel()));
|
||||
cmd.addArgs(commandLine.arguments(), CommandLine::Raw);
|
||||
} else {
|
||||
cmd.setExecutable(device()->debugServerPath());
|
||||
cmd.setExecutable(runControl()->device()->debugServerPath());
|
||||
|
||||
if (cmd.isEmpty()) {
|
||||
if (device()->osType() == Utils::OsTypeMac) {
|
||||
const FilePath debugServerLocation = device()->filePath(
|
||||
if (runControl()->device()->osType() == Utils::OsTypeMac) {
|
||||
const FilePath debugServerLocation = runControl()->device()->filePath(
|
||||
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/"
|
||||
"Resources/debugserver");
|
||||
|
||||
@@ -592,15 +592,15 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
// TODO: In the future it is expected that the debugserver will be
|
||||
// replaced by lldb-server. Remove the check for debug server at that point.
|
||||
const FilePath lldbserver
|
||||
= device()->filePath("lldb-server").searchInPath();
|
||||
= runControl()->device()->filePath("lldb-server").searchInPath();
|
||||
if (lldbserver.isExecutableFile())
|
||||
cmd.setExecutable(lldbserver);
|
||||
}
|
||||
} else {
|
||||
const FilePath gdbServerPath
|
||||
= device()->filePath("gdbserver").searchInPath();
|
||||
= runControl()->device()->filePath("gdbserver").searchInPath();
|
||||
FilePath lldbServerPath
|
||||
= device()->filePath("lldb-server").searchInPath();
|
||||
= runControl()->device()->filePath("lldb-server").searchInPath();
|
||||
|
||||
// TODO: Which one should we prefer?
|
||||
if (gdbServerPath.isExecutableFile())
|
||||
@@ -643,7 +643,7 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
const auto port = runControl()->debugChannel().port();
|
||||
cmd.addArg(QString(":%1").arg(port));
|
||||
|
||||
if (device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()) {
|
||||
if (runControl()->device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()) {
|
||||
QVariantHash extraData;
|
||||
extraData[RemoteLinux::Constants::SshForwardPort] = port;
|
||||
extraData[RemoteLinux::Constants::DisableSharing] = true;
|
||||
|
@@ -323,7 +323,7 @@ void DeviceCtlRunnerBase::start()
|
||||
}
|
||||
|
||||
appendMessage(Tr::tr("Running \"%1\" on %2...")
|
||||
.arg(m_bundlePath.toUserOutput(), device()->displayName()),
|
||||
.arg(m_bundlePath.toUserOutput(), runControl()->device()->displayName()),
|
||||
NormalMessageFormat);
|
||||
|
||||
// If the app is already running, we should first kill it, then launch again.
|
||||
@@ -906,7 +906,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
|
||||
{
|
||||
setId("IosDebugSupport");
|
||||
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(device());
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(runControl->device());
|
||||
DebuggerRunParameters &rp = runParameters();
|
||||
|
||||
if (dev->type() == Ios::Constants::IOS_SIMULATOR_TYPE
|
||||
@@ -922,7 +922,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
|
||||
addStartDependency(m_deviceCtlRunner);
|
||||
}
|
||||
|
||||
if (device()->type() == Ios::Constants::IOS_DEVICE_TYPE) {
|
||||
if (runControl->device()->type() == Ios::Constants::IOS_DEVICE_TYPE) {
|
||||
if (dev->handler() == IosDevice::Handler::DeviceCtl) {
|
||||
QTC_CHECK(IosDeviceManager::isDeviceCtlDebugSupported());
|
||||
rp.setStartMode(AttachToIosDevice);
|
||||
@@ -951,7 +951,7 @@ void IosDebugSupport::start()
|
||||
rp.setDisplayName(data->applicationName);
|
||||
rp.setContinueAfterAttach(true);
|
||||
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(device());
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(runControl()->device());
|
||||
if (dev->type() == Ios::Constants::IOS_DEVICE_TYPE
|
||||
&& dev->handler() == IosDevice::Handler::DeviceCtl) {
|
||||
const auto msgOnlyCppDebuggingSupported = [] {
|
||||
|
@@ -1882,11 +1882,6 @@ void RunWorker::appendMessage(const QString &msg, OutputFormat format, bool appe
|
||||
d->runControl->postMessage(msg, format, appendNewLine);
|
||||
}
|
||||
|
||||
IDevice::ConstPtr RunWorker::device() const
|
||||
{
|
||||
return d->runControl->device();
|
||||
}
|
||||
|
||||
void RunWorker::addStartDependency(RunWorker *dependency)
|
||||
{
|
||||
d->startDependencies.append(dependency);
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
|
||||
// Part of read-only interface of RunControl for convenience.
|
||||
void appendMessage(const QString &msg, Utils::OutputFormat format, bool appendNewLine = true);
|
||||
IDeviceConstPtr device() const;
|
||||
|
||||
// States
|
||||
void initiateStart();
|
||||
|
@@ -185,7 +185,7 @@ public:
|
||||
QStringList arguments;
|
||||
if (runControl->usesDebugChannel()) {
|
||||
const int pdebugPort = runControl->debugChannel().port();
|
||||
cmd.setExecutable(debuggeeRunner->device()->filePath(QNX_DEBUG_EXECUTABLE));
|
||||
cmd.setExecutable(runControl->device()->filePath(QNX_DEBUG_EXECUTABLE));
|
||||
arguments.append(QString::number(pdebugPort));
|
||||
}
|
||||
if (runControl->usesQmlChannel()) {
|
||||
|
@@ -35,7 +35,7 @@ void Slog2InfoRunner::start()
|
||||
QTC_CHECK(!m_taskTreeRunner.isRunning());
|
||||
|
||||
const auto onTestSetup = [this](Process &process) {
|
||||
process.setCommand(CommandLine{device()->filePath("slog2info")});
|
||||
process.setCommand(CommandLine{runControl()->device()->filePath("slog2info")});
|
||||
};
|
||||
const auto onTestDone = [this] {
|
||||
appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, "
|
||||
@@ -43,7 +43,7 @@ void Slog2InfoRunner::start()
|
||||
};
|
||||
|
||||
const auto onLaunchTimeSetup = [this](Process &process) {
|
||||
process.setCommand({device()->filePath("date"), "+\"%d %H:%M:%S\"", CommandLine::Raw});
|
||||
process.setCommand({runControl()->device()->filePath("date"), "+\"%d %H:%M:%S\"", CommandLine::Raw});
|
||||
};
|
||||
const auto onLaunchTimeDone = [this](const Process &process) {
|
||||
QTC_CHECK(!m_applicationId.isEmpty());
|
||||
@@ -51,7 +51,7 @@ void Slog2InfoRunner::start()
|
||||
};
|
||||
|
||||
const auto onLogSetup = [this](Process &process) {
|
||||
process.setCommand({device()->filePath("slog2info"), {"-w"}});
|
||||
process.setCommand({runControl()->device()->filePath("slog2info"), {"-w"}});
|
||||
connect(&process, &Process::readyReadStandardOutput, this, [this, processPtr = &process] {
|
||||
processLogInput(QString::fromLatin1(processPtr->readAllRawStandardOutput()));
|
||||
});
|
||||
|
@@ -123,9 +123,9 @@ QString MemcheckToolRunner::progressTitle() const
|
||||
|
||||
void MemcheckToolRunner::start()
|
||||
{
|
||||
if (device()->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
if (runControl()->device()->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
m_process.reset(new Process);
|
||||
m_process->setCommand({device()->filePath("echo"), "-n $SSH_CLIENT", CommandLine::Raw});
|
||||
m_process->setCommand({runControl()->device()->filePath("echo"), "-n $SSH_CLIENT", CommandLine::Raw});
|
||||
connect(m_process.get(), &Process::done, this, [this] {
|
||||
const ProcessResult result = m_process->result();
|
||||
const QByteArrayList data = m_process->rawStdOut().split(' ');
|
||||
|
Reference in New Issue
Block a user