forked from qt-creator/qt-creator
ProjectExplorer: Dissolve SubChannelProvider
The channels can be extracted directly once the PortGatherer is finished, before the start() of the RunWorkerTree. Also, manager the one debug and one qml channel for the whole runworker tree centrally in RunControl. There is quite some potential for clean up left. Change-Id: I2d877d34958cb67aa324c9b5a6f1529872b74b16 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -178,7 +178,6 @@ void AndroidDebugSupport::start()
|
||||
if (isQmlDebugging()) {
|
||||
qCDebug(androidDebugSupportLog) << "QML debugging enabled. QML server: "
|
||||
<< m_runner->qmlServer().toDisplayString();
|
||||
setQmlServer(m_runner->qmlServer());
|
||||
//TODO: Not sure if these are the right paths.
|
||||
if (qtVersion)
|
||||
addSearchDirectory(qtVersion->qmlPath());
|
||||
|
@@ -48,20 +48,14 @@ public:
|
||||
appendMessage(m_launcher.readAllStandardError(), StdErrFormat);
|
||||
});
|
||||
|
||||
if (useGdbServer) {
|
||||
m_debugChannelProvider = new SubChannelProvider(runControl);
|
||||
addStartDependency(m_debugChannelProvider);
|
||||
}
|
||||
if (useGdbServer)
|
||||
runControl->requestDebugChannel();
|
||||
|
||||
if (useQmlServer) {
|
||||
m_qmlChannelProvider = new SubChannelProvider(runControl);
|
||||
addStartDependency(m_qmlChannelProvider);
|
||||
}
|
||||
if (useQmlServer)
|
||||
runControl->requestQmlChannel();
|
||||
|
||||
if (usePerf) {
|
||||
m_perfChannelProvider = new SubChannelProvider(runControl);
|
||||
addStartDependency(m_perfChannelProvider);
|
||||
}
|
||||
if (usePerf)
|
||||
runControl->requestPerfChannel();
|
||||
}
|
||||
|
||||
void start() override
|
||||
@@ -72,30 +66,30 @@ public:
|
||||
CommandLine cmd;
|
||||
cmd.setExecutable(device()->filePath(Constants::AppcontrollerFilepath));
|
||||
|
||||
if (m_debugChannelProvider) {
|
||||
if (usesDebugChannel()) {
|
||||
cmd.addArg("--debug-gdb");
|
||||
lowerPort = upperPort = m_debugChannelProvider->channel().port();
|
||||
lowerPort = upperPort = debugChannel().port();
|
||||
}
|
||||
if (m_qmlChannelProvider) {
|
||||
if (usesQmlChannel()) {
|
||||
cmd.addArg("--debug-qml");
|
||||
cmd.addArg("--qml-debug-services");
|
||||
cmd.addArg(QmlDebug::qmlDebugServices(m_qmlServices));
|
||||
lowerPort = upperPort = m_qmlChannelProvider->channel().port();
|
||||
lowerPort = upperPort = qmlChannel().port();
|
||||
}
|
||||
if (m_debugChannelProvider && m_qmlChannelProvider) {
|
||||
lowerPort = m_debugChannelProvider->channel().port();
|
||||
upperPort = m_qmlChannelProvider->channel().port();
|
||||
if (usesDebugChannel() && usesQmlChannel()) {
|
||||
lowerPort = debugChannel().port();
|
||||
upperPort = qmlChannel().port();
|
||||
if (lowerPort + 1 != upperPort) {
|
||||
reportFailure("Need adjacent free ports for combined C++/QML debugging");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_perfChannelProvider) {
|
||||
if (usesPerfChannel()) {
|
||||
const Store perfArgs = runControl()->settingsData(PerfProfiler::Constants::PerfSettingsId);
|
||||
const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString();
|
||||
cmd.addArg("--profile-perf");
|
||||
cmd.addArgs(recordArgs, CommandLine::Raw);
|
||||
lowerPort = upperPort = m_perfChannelProvider->channel().port();
|
||||
lowerPort = upperPort = perfChannel().port();
|
||||
}
|
||||
cmd.addArg("--port-range");
|
||||
cmd.addArg(QString("%1-%2").arg(lowerPort).arg(upperPort));
|
||||
@@ -115,9 +109,6 @@ private:
|
||||
friend class QdbDeviceQmlToolingSupport;
|
||||
friend class QdbDevicePerfProfilerSupport;
|
||||
|
||||
Debugger::SubChannelProvider *m_debugChannelProvider = nullptr;
|
||||
Debugger::SubChannelProvider *m_qmlChannelProvider = nullptr;
|
||||
Debugger::SubChannelProvider *m_perfChannelProvider = nullptr;
|
||||
QmlDebug::QmlDebugServicesPreset m_qmlServices;
|
||||
Process m_launcher;
|
||||
};
|
||||
@@ -172,10 +163,10 @@ void QdbDeviceDebugSupport::start()
|
||||
{
|
||||
setStartMode(Debugger::AttachToRemoteServer);
|
||||
setCloseMode(KillAndExitMonitorAtClose);
|
||||
if (SubChannelProvider *provider = m_debuggee->m_debugChannelProvider)
|
||||
setRemoteChannel(provider->channel());
|
||||
if (SubChannelProvider *provider = m_debuggee->m_qmlChannelProvider)
|
||||
setQmlServer(provider->channel());
|
||||
if (usesDebugChannel())
|
||||
setRemoteChannel(debugChannel());
|
||||
if (usesQmlChannel())
|
||||
setQmlServer(qmlChannel());
|
||||
setUseContinueInsteadOfRun(true);
|
||||
setContinueAfterAttach(true);
|
||||
addSolibSearchDir("%{sysroot}/system/lib");
|
||||
@@ -221,8 +212,8 @@ QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
|
||||
|
||||
void QdbDeviceQmlToolingSupport::start()
|
||||
{
|
||||
QTC_ASSERT(m_runner->m_qmlChannelProvider, reportFailure({}));
|
||||
m_worker->recordData("QmlServerUrl", m_runner->m_qmlChannelProvider->channel());
|
||||
QTC_ASSERT(usesQmlChannel(), reportFailure({}));
|
||||
m_worker->recordData("QmlServerUrl", qmlChannel());
|
||||
reportStarted();
|
||||
}
|
||||
|
||||
@@ -252,8 +243,8 @@ QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runContro
|
||||
|
||||
void QdbDevicePerfProfilerSupport::start()
|
||||
{
|
||||
QTC_ASSERT(m_profilee->m_perfChannelProvider, reportFailure({}));
|
||||
runControl()->setProperty("PerfConnection", m_profilee->m_perfChannelProvider->channel());
|
||||
QTC_ASSERT(usesPerfChannel(), reportFailure({}));
|
||||
runControl()->setProperty("PerfConnection", perfChannel());
|
||||
reportStarted();
|
||||
}
|
||||
|
||||
|
@@ -156,8 +156,6 @@ class DebuggerRunToolPrivate
|
||||
{
|
||||
public:
|
||||
QPointer<CoreUnpacker> coreUnpacker;
|
||||
QPointer<SubChannelProvider> debugChannelProvider;
|
||||
QPointer<SubChannelProvider> qmlChannelProvider;
|
||||
bool addQmlServerInferiorCommandLineArgumentIfNeeded = false;
|
||||
int snapshotCounter = 0;
|
||||
int engineStartsNeeded = 0;
|
||||
@@ -170,7 +168,6 @@ public:
|
||||
|
||||
// DebugServer
|
||||
Process debuggerServerProc;
|
||||
bool useDebugServer = false;
|
||||
Utils::ProcessHandle serverAttachPid;
|
||||
bool serverUseMulti = true;
|
||||
bool serverEssential = true;
|
||||
@@ -309,16 +306,12 @@ void DebuggerRunTool::setCommandsForReset(const QString &commands)
|
||||
{
|
||||
m_runParameters.commandsForReset = commands;
|
||||
}
|
||||
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
|
||||
|
||||
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
|
||||
{
|
||||
m_runParameters.debugInfoLocation = debugInfoLocation;
|
||||
}
|
||||
|
||||
QUrl DebuggerRunTool::qmlServer() const
|
||||
{
|
||||
return m_runParameters.qmlServer;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setQmlServer(const QUrl &qmlServer)
|
||||
{
|
||||
m_runParameters.qmlServer = qmlServer;
|
||||
@@ -464,11 +457,11 @@ void DebuggerRunTool::continueAfterTerminalStart()
|
||||
{
|
||||
TaskHub::clearTasks(Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
|
||||
|
||||
if (d->debugChannelProvider)
|
||||
setRemoteChannel(d->debugChannelProvider->channel());
|
||||
if (usesDebugChannel())
|
||||
setRemoteChannel(debugChannel());
|
||||
|
||||
if (d->qmlChannelProvider) {
|
||||
setQmlServer(d->qmlChannelProvider->channel());
|
||||
if (usesQmlChannel()) {
|
||||
setQmlServer(qmlChannel());
|
||||
if (d->addQmlServerInferiorCommandLineArgumentIfNeeded
|
||||
&& m_runParameters.isQmlDebugging
|
||||
&& m_runParameters.isCppDebugging()) {
|
||||
@@ -758,39 +751,10 @@ bool DebuggerRunTool::isQmlDebugging() const
|
||||
|
||||
void DebuggerRunTool::setUsePortsGatherer(bool useCpp, bool useQml)
|
||||
{
|
||||
runControl()->enablePortsGatherer();
|
||||
if (useCpp) {
|
||||
QTC_ASSERT(!d->debugChannelProvider, reportFailure(); return);
|
||||
d->debugChannelProvider = new SubChannelProvider(runControl());
|
||||
addStartDependency(d->debugChannelProvider);
|
||||
}
|
||||
if (useQml) {
|
||||
QTC_ASSERT(!d->qmlChannelProvider, reportFailure(); return);
|
||||
d->qmlChannelProvider = new SubChannelProvider(runControl());
|
||||
addStartDependency(d->qmlChannelProvider);
|
||||
}
|
||||
}
|
||||
|
||||
SubChannelProvider *DebuggerRunTool::debugChannelProvider() const
|
||||
{
|
||||
return d->debugChannelProvider;
|
||||
}
|
||||
|
||||
QUrl DebuggerRunTool::debugChannel() const
|
||||
{
|
||||
QTC_ASSERT(d->debugChannelProvider, return {});
|
||||
return d->debugChannelProvider->channel();
|
||||
}
|
||||
|
||||
SubChannelProvider *DebuggerRunTool::qmlChannelProvider() const
|
||||
{
|
||||
return d->qmlChannelProvider;
|
||||
}
|
||||
|
||||
QUrl DebuggerRunTool::qmlChannel() const
|
||||
{
|
||||
QTC_ASSERT(d->qmlChannelProvider, return {});
|
||||
return d->qmlChannelProvider->channel();
|
||||
if (useCpp)
|
||||
runControl()->requestDebugChannel();
|
||||
if (useQml)
|
||||
runControl()->requestQmlChannel();
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setSolibSearchPath(const Utils::FilePaths &list)
|
||||
@@ -1085,26 +1049,9 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
|
||||
forwarding.
|
||||
*/
|
||||
|
||||
SubChannelProvider::SubChannelProvider(RunControl *runControl)
|
||||
: RunWorker(runControl)
|
||||
{
|
||||
setId("SubChannelProvider");
|
||||
}
|
||||
|
||||
void SubChannelProvider::start()
|
||||
{
|
||||
m_channel.setScheme(urlTcpScheme());
|
||||
if (device()->extraData(RemoteLinux::Constants::SshForwardDebugServerPort).toBool())
|
||||
m_channel.setHost("localhost");
|
||||
else
|
||||
m_channel.setHost(device()->toolControlChannel(IDevice::ControlChannelHint()).host());
|
||||
m_channel.setPort(runControl()->findEndPoint().port());
|
||||
reportStarted();
|
||||
}
|
||||
|
||||
void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
{
|
||||
if (!d->useDebugServer) {
|
||||
if (!usesDebugChannel()) {
|
||||
continueAfterDebugServerStart();
|
||||
return;
|
||||
}
|
||||
@@ -1114,11 +1061,10 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
CommandLine commandLine = m_runParameters.inferior.command;
|
||||
CommandLine cmd;
|
||||
|
||||
if (d->qmlChannelProvider && !d->debugChannelProvider) {
|
||||
if (usesQmlChannel() && !usesDebugChannel()) {
|
||||
// FIXME: Case should not happen?
|
||||
cmd.setExecutable(commandLine.executable());
|
||||
cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
|
||||
d->qmlChannelProvider->channel()));
|
||||
cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, qmlChannel()));
|
||||
cmd.addArgs(commandLine.arguments(), CommandLine::Raw);
|
||||
} else {
|
||||
cmd.setExecutable(device()->debugServerPath());
|
||||
@@ -1162,15 +1108,15 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
}
|
||||
}
|
||||
}
|
||||
QTC_ASSERT(d->debugChannelProvider, reportFailure({}));
|
||||
QTC_ASSERT(usesDebugChannel(), reportFailure({}));
|
||||
if (cmd.executable().baseName().contains("lldb-server")) {
|
||||
cmd.addArg("platform");
|
||||
cmd.addArg("--listen");
|
||||
cmd.addArg(QString("*:%1").arg(d->debugChannelProvider->channel().port()));
|
||||
cmd.addArg(QString("*:%1").arg(debugChannel().port()));
|
||||
cmd.addArg("--server");
|
||||
} else if (cmd.executable().baseName() == "debugserver") {
|
||||
const QString ipAndPort("`echo $SSH_CLIENT | cut -d ' ' -f 1`:%1");
|
||||
cmd.addArgs(ipAndPort.arg(d->debugChannelProvider->channel().port()), CommandLine::Raw);
|
||||
cmd.addArgs(ipAndPort.arg(debugChannel().port()), CommandLine::Raw);
|
||||
|
||||
if (d->serverAttachPid.isValid())
|
||||
cmd.addArgs({"--attach", QString::number(d->serverAttachPid.pid())});
|
||||
@@ -1183,10 +1129,10 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
if (d->serverAttachPid.isValid())
|
||||
cmd.addArg("--attach");
|
||||
|
||||
const auto port = d->debugChannelProvider->channel().port();
|
||||
const auto port = debugChannel().port();
|
||||
cmd.addArg(QString(":%1").arg(port));
|
||||
|
||||
if (device()->extraData(RemoteLinux::Constants::SshForwardDebugServerPort).toBool()) {
|
||||
if (device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()) {
|
||||
QVariantHash extraData;
|
||||
extraData[RemoteLinux::Constants::SshForwardPort] = port;
|
||||
extraData[RemoteLinux::Constants::DisableSharing] = true;
|
||||
@@ -1216,7 +1162,7 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup()
|
||||
|
||||
void DebuggerRunTool::setUseDebugServer(ProcessHandle attachPid, bool essential, bool useMulti)
|
||||
{
|
||||
d->useDebugServer = true;
|
||||
runControl()->requestDebugChannel();
|
||||
d->serverAttachPid = attachPid;
|
||||
d->serverEssential = essential;
|
||||
d->serverUseMulti = useMulti;
|
||||
|
@@ -70,7 +70,6 @@ public:
|
||||
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
|
||||
|
||||
void setQmlServer(const QUrl &qmlServer);
|
||||
QUrl qmlServer() const; // Used in GammaRay integration.
|
||||
|
||||
void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false);
|
||||
|
||||
@@ -82,12 +81,6 @@ public:
|
||||
|
||||
Internal::DebuggerRunParameters &runParameters() { return m_runParameters; }
|
||||
|
||||
QUrl debugChannel() const;
|
||||
SubChannelProvider *debugChannelProvider() const;
|
||||
|
||||
QUrl qmlChannel() const;
|
||||
SubChannelProvider *qmlChannelProvider() const;
|
||||
|
||||
protected:
|
||||
bool isCppDebugging() const;
|
||||
bool isQmlDebugging() const;
|
||||
@@ -129,19 +122,6 @@ private:
|
||||
Internal::DebuggerRunParameters m_runParameters;
|
||||
};
|
||||
|
||||
class DEBUGGER_EXPORT SubChannelProvider : public ProjectExplorer::RunWorker
|
||||
{
|
||||
public:
|
||||
explicit SubChannelProvider(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
void start() final;
|
||||
|
||||
QUrl channel() const { return m_channel; }
|
||||
|
||||
private:
|
||||
QUrl m_channel;
|
||||
};
|
||||
|
||||
class DebuggerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
|
@@ -224,6 +224,7 @@ const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.
|
||||
// Called "RemoteLinux." for backwards compatibility
|
||||
const char SUPPORTS_RSYNC[] = "RemoteLinux.SupportsRSync";
|
||||
const char SUPPORTS_SFTP[] = "RemoteLinux.SupportsSftp";
|
||||
const char SSH_FORWARD_DEBUGSERVER_PORT[] = "RemoteLinux.SshForwardDebugServerPort";
|
||||
|
||||
// UI texts
|
||||
PROJECTEXPLORER_EXPORT QString msgAutoDetected();
|
||||
|
@@ -294,6 +294,13 @@ public:
|
||||
bool autoDelete = false;
|
||||
bool m_supportsReRunning = true;
|
||||
std::optional<Group> m_runRecipe;
|
||||
|
||||
bool useDebugChannel = false;
|
||||
bool useQmlChannel = false;
|
||||
bool usePerfChannel = false;
|
||||
QUrl debugChannel;
|
||||
QUrl qmlChannel;
|
||||
QUrl perfChannel;
|
||||
};
|
||||
|
||||
class RunControlPrivate : public QObject, public RunControlPrivateData
|
||||
@@ -349,6 +356,9 @@ public:
|
||||
void startTaskTree();
|
||||
void checkAutoDeleteAndEmitStopped();
|
||||
|
||||
void enablePortsGatherer();
|
||||
QUrl getNextChannel();
|
||||
|
||||
RunControl *q;
|
||||
Id runMode;
|
||||
TaskTreeRunner m_taskTreeRunner;
|
||||
@@ -590,6 +600,13 @@ void RunControlPrivate::startPortsGathererIfNeededAndContinueStart()
|
||||
portList = device->freePorts();
|
||||
q->appendMessage(Tr::tr("Found %n free ports.", nullptr, portList.count()) + '\n',
|
||||
NormalMessageFormat);
|
||||
if (useDebugChannel)
|
||||
debugChannel = getNextChannel();
|
||||
if (useQmlChannel)
|
||||
qmlChannel = getNextChannel();
|
||||
if (usePerfChannel)
|
||||
perfChannel = getNextChannel();
|
||||
|
||||
continueStart();
|
||||
} else {
|
||||
onWorkerFailed(nullptr, portsGatherer->errorString());
|
||||
@@ -603,7 +620,26 @@ void RunControlPrivate::startPortsGathererIfNeededAndContinueStart()
|
||||
|
||||
void RunControl::enablePortsGatherer()
|
||||
{
|
||||
d->portsGatherer = std::make_unique<DeviceUsedPortsGatherer>();
|
||||
d->enablePortsGatherer();
|
||||
}
|
||||
|
||||
void RunControlPrivate::enablePortsGatherer()
|
||||
{
|
||||
if (!portsGatherer)
|
||||
portsGatherer = std::make_unique<DeviceUsedPortsGatherer>();
|
||||
}
|
||||
|
||||
QUrl RunControlPrivate::getNextChannel()
|
||||
{
|
||||
QTC_ASSERT(portsGatherer, return {});
|
||||
QUrl result;
|
||||
result.setScheme(urlTcpScheme());
|
||||
if (q->device()->extraData(Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool())
|
||||
result.setHost("localhost");
|
||||
else
|
||||
result.setHost(q->device()->toolControlChannel(IDevice::ControlChannelHint()).host());
|
||||
result.setPort(portList.getNextFreePort(portsGatherer->usedPorts()).number());
|
||||
return result;
|
||||
}
|
||||
|
||||
QUrl RunControl::findEndPoint()
|
||||
@@ -616,6 +652,54 @@ QUrl RunControl::findEndPoint()
|
||||
return result;
|
||||
}
|
||||
|
||||
void RunControl::requestDebugChannel()
|
||||
{
|
||||
d->enablePortsGatherer();
|
||||
d->useDebugChannel = true;
|
||||
}
|
||||
|
||||
bool RunControl::usesDebugChannel() const
|
||||
{
|
||||
return d->useDebugChannel;
|
||||
}
|
||||
|
||||
QUrl RunControl::debugChannel() const
|
||||
{
|
||||
return d->debugChannel;
|
||||
}
|
||||
|
||||
void RunControl::requestQmlChannel()
|
||||
{
|
||||
d->enablePortsGatherer();
|
||||
d->useQmlChannel = true;
|
||||
}
|
||||
|
||||
bool RunControl::usesQmlChannel() const
|
||||
{
|
||||
return d->useQmlChannel;
|
||||
}
|
||||
|
||||
QUrl RunControl::qmlChannel() const
|
||||
{
|
||||
return d->qmlChannel;
|
||||
}
|
||||
|
||||
void RunControl::requestPerfChannel()
|
||||
{
|
||||
d->enablePortsGatherer();
|
||||
d->usePerfChannel = true;
|
||||
}
|
||||
|
||||
bool RunControl::usesPerfChannel() const
|
||||
{
|
||||
return d->usePerfChannel;
|
||||
}
|
||||
|
||||
QUrl RunControl::perfChannel() const
|
||||
{
|
||||
return d->perfChannel;
|
||||
}
|
||||
|
||||
void RunControlPrivate::continueStart()
|
||||
{
|
||||
checkState(RunControlState::Starting);
|
||||
@@ -1909,6 +1993,36 @@ void RunWorker::setEssential(bool essential)
|
||||
d->essential = essential;
|
||||
}
|
||||
|
||||
QUrl RunWorker::debugChannel() const
|
||||
{
|
||||
return d->runControl->debugChannel();
|
||||
}
|
||||
|
||||
bool RunWorker::usesDebugChannel() const
|
||||
{
|
||||
return d->runControl->usesDebugChannel();
|
||||
}
|
||||
|
||||
QUrl RunWorker::qmlChannel() const
|
||||
{
|
||||
return d->runControl->qmlChannel();
|
||||
}
|
||||
|
||||
bool RunWorker::usesQmlChannel() const
|
||||
{
|
||||
return d->runControl->usesQmlChannel();
|
||||
}
|
||||
|
||||
QUrl RunWorker::perfChannel() const
|
||||
{
|
||||
return d->runControl->perfChannel();
|
||||
}
|
||||
|
||||
bool RunWorker::usesPerfChannel() const
|
||||
{
|
||||
return d->runControl->usesPerfChannel();
|
||||
}
|
||||
|
||||
void RunWorker::start()
|
||||
{
|
||||
reportStarted();
|
||||
|
@@ -81,6 +81,15 @@ public:
|
||||
bool isEssential() const;
|
||||
void setEssential(bool essential);
|
||||
|
||||
QUrl debugChannel() const;
|
||||
bool usesDebugChannel() const;
|
||||
|
||||
QUrl qmlChannel() const;
|
||||
bool usesQmlChannel() const;
|
||||
|
||||
QUrl perfChannel() const;
|
||||
bool usesPerfChannel() const;
|
||||
|
||||
signals:
|
||||
void started();
|
||||
void stopped();
|
||||
@@ -237,6 +246,18 @@ public:
|
||||
void enablePortsGatherer();
|
||||
QUrl findEndPoint();
|
||||
|
||||
void requestDebugChannel();
|
||||
bool usesDebugChannel() const;
|
||||
QUrl debugChannel() const;
|
||||
|
||||
void requestQmlChannel();
|
||||
bool usesQmlChannel() const;
|
||||
QUrl qmlChannel() const;
|
||||
|
||||
void requestPerfChannel();
|
||||
bool usesPerfChannel() const;
|
||||
QUrl perfChannel() const;
|
||||
|
||||
signals:
|
||||
void appendMessage(const QString &msg, Utils::OutputFormat format);
|
||||
void aboutToStart();
|
||||
|
@@ -76,22 +76,22 @@ static QStringList searchPaths(Kit *kit)
|
||||
class QnxDebuggeeRunner : public ProjectExplorer::SimpleTargetRunner
|
||||
{
|
||||
public:
|
||||
QnxDebuggeeRunner(RunControl *runControl, DebuggerRunTool *debugger)
|
||||
explicit QnxDebuggeeRunner(RunControl *runControl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
setId("QnxDebuggeeRunner");
|
||||
|
||||
setStartModifier([this, debugger] {
|
||||
setStartModifier([this] {
|
||||
CommandLine cmd = commandLine();
|
||||
QStringList arguments;
|
||||
if (SubChannelProvider *provider = debugger->debugChannelProvider()) {
|
||||
int pdebugPort = provider->channel().port();
|
||||
if (usesDebugChannel()) {
|
||||
int pdebugPort = debugChannel().port();
|
||||
cmd.setExecutable(device()->filePath(QNX_DEBUG_EXECUTABLE));
|
||||
arguments.append(QString::number(pdebugPort));
|
||||
}
|
||||
if (SubChannelProvider *provider = debugger->qmlChannelProvider()) {
|
||||
if (usesQmlChannel()) {
|
||||
arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
|
||||
provider->channel()));
|
||||
qmlChannel()));
|
||||
}
|
||||
cmd.setArguments(ProcessArgs::joinArgs(arguments));
|
||||
setCommandLine(cmd);
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
|
||||
setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
|
||||
|
||||
auto debuggeeRunner = new QnxDebuggeeRunner(runControl, this);
|
||||
auto debuggeeRunner = new QnxDebuggeeRunner(runControl);
|
||||
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
debuggeeRunner->addStartDependency(slog2InfoRunner);
|
||||
|
@@ -109,19 +109,14 @@ public:
|
||||
if (usePerf) {
|
||||
suppressDefaultStdOutHandling();
|
||||
runControl->setProperty("PerfProcess", QVariant::fromValue(process()));
|
||||
m_perfChannelProvider = new Debugger::SubChannelProvider(runControl);
|
||||
addStartDependency(m_perfChannelProvider);
|
||||
runControl->requestPerfChannel();
|
||||
}
|
||||
|
||||
if (useGdbServer) {
|
||||
m_debugChannelProvider = new Debugger::SubChannelProvider(runControl);
|
||||
addStartDependency(m_debugChannelProvider);
|
||||
}
|
||||
if (useGdbServer)
|
||||
runControl->requestDebugChannel();
|
||||
|
||||
if (useQmlServer) {
|
||||
m_qmlChannelProvider = new Debugger::SubChannelProvider(runControl);
|
||||
addStartDependency(m_qmlChannelProvider);
|
||||
}
|
||||
if (useQmlServer)
|
||||
runControl->requestQmlChannel();
|
||||
|
||||
setStartModifier([this, runControl] {
|
||||
FilePath controller = runControl->aspectData<AppManagerControllerAspect>()->filePath;
|
||||
@@ -140,22 +135,21 @@ public:
|
||||
|
||||
cmd.addArg("debug-application");
|
||||
|
||||
if (m_debugChannelProvider || m_qmlChannelProvider) {
|
||||
if (usesDebugChannel() || usesQmlChannel()) {
|
||||
QStringList debugArgs;
|
||||
debugArgs.append(envVars.join(' '));
|
||||
if (m_debugChannelProvider) {
|
||||
debugArgs.append(QString("gdbserver :%1").arg(m_debugChannelProvider->channel().port()));
|
||||
}
|
||||
if (m_qmlChannelProvider) {
|
||||
if (usesDebugChannel())
|
||||
debugArgs.append(QString("gdbserver :%1").arg(debugChannel().port()));
|
||||
if (usesQmlChannel()) {
|
||||
const QString qmlArgs =
|
||||
qmlDebugCommandLineArguments(m_qmlServices,
|
||||
QString("port:%1").arg(m_qmlChannelProvider->channel().port()),
|
||||
QString("port:%1").arg(qmlChannel().port()),
|
||||
true);
|
||||
debugArgs.append(QString("%program% %1 %arguments%") .arg(qmlArgs));
|
||||
}
|
||||
cmd.addArg(debugArgs.join(' '));
|
||||
}
|
||||
if (m_perfChannelProvider) {
|
||||
if (usesPerfChannel()) {
|
||||
const Store perfArgs = runControl->settingsData(PerfProfiler::Constants::PerfSettingsId);
|
||||
const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString();
|
||||
cmd.addArg(QString("perf record %1 -o - --").arg(recordArgs));
|
||||
@@ -181,22 +175,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
QUrl gdbServer() const
|
||||
{
|
||||
QTC_ASSERT(m_debugChannelProvider, return {});
|
||||
return m_debugChannelProvider->channel();
|
||||
}
|
||||
|
||||
QUrl qmlServer() const
|
||||
{
|
||||
QTC_ASSERT(m_qmlChannelProvider, return {});
|
||||
return m_qmlChannelProvider->channel();
|
||||
}
|
||||
|
||||
private:
|
||||
Debugger::SubChannelProvider *m_debugChannelProvider = nullptr;
|
||||
Debugger::SubChannelProvider *m_qmlChannelProvider = nullptr;
|
||||
Debugger::SubChannelProvider *m_perfChannelProvider = nullptr;
|
||||
QmlDebug::QmlDebugServicesPreset m_qmlServices;
|
||||
};
|
||||
|
||||
@@ -252,13 +231,13 @@ private:
|
||||
setCloseMode(Debugger::KillAndExitMonitorAtClose);
|
||||
|
||||
if (isQmlDebugging())
|
||||
setQmlServer(m_debuggee->qmlServer());
|
||||
setQmlServer(qmlChannel());
|
||||
|
||||
if (isCppDebugging()) {
|
||||
setUseExtendedRemote(false);
|
||||
setUseContinueInsteadOfRun(true);
|
||||
setContinueAfterAttach(true);
|
||||
setRemoteChannel(m_debuggee->gdbServer());
|
||||
setRemoteChannel(debugChannel());
|
||||
setSymbolFile(m_symbolFile);
|
||||
|
||||
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl()->kit());
|
||||
@@ -304,7 +283,7 @@ public:
|
||||
private:
|
||||
void start() final
|
||||
{
|
||||
m_worker->recordData("QmlServerUrl", m_runner->qmlServer());
|
||||
m_worker->recordData("QmlServerUrl", qmlChannel());
|
||||
reportStarted();
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/devicesupport/sshparameters.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
@@ -265,7 +266,7 @@ void GenericLinuxDeviceConfigurationWidget::linkDeviceChanged(int index)
|
||||
|
||||
void GenericLinuxDeviceConfigurationWidget::sshPortForwardingForDebugging(bool on)
|
||||
{
|
||||
device()->setExtraData(Constants::SshForwardDebugServerPort, on);
|
||||
device()->setExtraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT, on);
|
||||
}
|
||||
|
||||
void GenericLinuxDeviceConfigurationWidget::updateDeviceFromUi()
|
||||
@@ -347,7 +348,8 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
|
||||
sshParams.authenticationType == SshParameters::AuthenticationTypeSpecificKey);
|
||||
m_gdbServerLineEdit->setFilePath(device()->debugServerPath());
|
||||
m_qmlRuntimeLineEdit->setFilePath(device()->qmlRunCommand());
|
||||
m_useSshPortForwardingForDebugging->setChecked(device()->extraData(Constants::SshForwardDebugServerPort).toBool());
|
||||
m_useSshPortForwardingForDebugging->setChecked(
|
||||
device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool());
|
||||
|
||||
updatePortsWarningLabel();
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ const char KillAppStepId[] = "RemoteLinux.KillAppStep";
|
||||
|
||||
const char SourceProfile[] = "RemoteLinux.SourceProfile";
|
||||
const char LinkDevice[] = "RemoteLinux.LinkDevice";
|
||||
const char SshForwardDebugServerPort[] = "RemoteLinux.SshForwardDebugServerPort";
|
||||
const char SshForwardPort[] = "RemoteLinux.SshForwardPort";
|
||||
const char DisableSharing[] = "RemoteLinux.DisableSharing";
|
||||
|
||||
|
Reference in New Issue
Block a user