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