forked from qt-creator/qt-creator
Debugger, QmlProfiler et al: Replace AnalyzerStartParameter
... and QmlProfilerRunner::Configuaration by PE::UrlConnection, and call it 'serverUrl' on the user side. That's the only variant we ever had and avoids "translations" between three structures that are essential the same. Change-Id: I33386b2b8d2a7985ff934f6f8f840de0831bf9c1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <utils/port.h>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
namespace QmlDebug {
|
||||
|
||||
@@ -84,4 +85,15 @@ static inline QString qmlDebugLocalArguments(QmlDebugServicesPreset services, co
|
||||
return qmlDebugCommandLineArguments(services, QLatin1String("file:") + socket, block);
|
||||
}
|
||||
|
||||
static inline QString qmlDebugArguments(QmlDebugServicesPreset services, const QUrl &serverUrl,
|
||||
bool block = true)
|
||||
{
|
||||
if (serverUrl.scheme() == "socket")
|
||||
return qmlDebugCommandLineArguments(services, "file:" + serverUrl.path(), block);
|
||||
else
|
||||
return qmlDebugCommandLineArguments(services, serverUrl.port() != -1 ?
|
||||
QString("port:%1").arg(serverUrl.port()) :
|
||||
"port:%qml_port%", block);
|
||||
}
|
||||
|
||||
} // namespace QmlDebug
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
@@ -37,9 +36,6 @@
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QTcpServer>
|
||||
|
||||
using namespace Debugger;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -51,16 +47,9 @@ AndroidAnalyzeSupport::AndroidAnalyzeSupport(RunControl *runControl)
|
||||
{
|
||||
setDisplayName("AndroidAnalyzeSupport");
|
||||
|
||||
AnalyzerConnection connection;
|
||||
if (runMode() == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||
QTcpServer server;
|
||||
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|
||||
|| server.listen(QHostAddress::LocalHostIPv6), return);
|
||||
connection.analyzerHost = server.serverAddress().toString();
|
||||
}
|
||||
RunConfiguration *runConfig = runControl->runConfiguration();
|
||||
runControl->setDisplayName(AndroidManager::packageName(runConfig->target()));
|
||||
runControl->setConnection(connection);
|
||||
runControl->setConnection(UrlConnection::localHostWithoutPort());
|
||||
|
||||
auto runner = new AndroidRunner(runControl);
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
@@ -13,7 +13,6 @@ SOURCES += \
|
||||
HEADERS += \
|
||||
$$PWD/analyzerconstants.h \
|
||||
$$PWD/analyzermanager.h \
|
||||
$$PWD/analyzerstartparameters.h \
|
||||
$$PWD/analyzerrunconfigwidget.h \
|
||||
$$PWD/analyzerutils.h \
|
||||
$$PWD/detailederrorview.h \
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <debugger/debugger_global.h>
|
||||
|
||||
#include <ssh/sshconnection.h>
|
||||
#include <utils/port.h>
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DEBUGGER_EXPORT AnalyzerConnection
|
||||
{
|
||||
public:
|
||||
QSsh::SshConnectionParameters connParams;
|
||||
QString analyzerHost;
|
||||
QString analyzerSocket;
|
||||
Utils::Port analyzerPort;
|
||||
|
||||
static void *staticTypeId;
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "startremotedialog.h"
|
||||
|
||||
#include "analyzerstartparameters.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/kitchooser.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
@@ -130,11 +128,14 @@ void StartRemoteDialog::validate()
|
||||
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
}
|
||||
|
||||
QSsh::SshConnectionParameters StartRemoteDialog::sshParams() const
|
||||
QUrl StartRemoteDialog::serverUrl() const
|
||||
{
|
||||
QUrl url;
|
||||
Kit *kit = d->kitChooser->currentKit();
|
||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
return device->sshParameters();
|
||||
url.setHost(device->sshParameters().host);
|
||||
url.setPort(device->sshParameters().port);
|
||||
return url;
|
||||
}
|
||||
|
||||
StandardRunnable StartRemoteDialog::runnable() const
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include <debugger/debugger_global.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace QSsh { class SshConnectionParameters; }
|
||||
#include <QUrl>
|
||||
|
||||
namespace ProjectExplorer { class StandardRunnable; }
|
||||
|
||||
@@ -45,7 +44,7 @@ public:
|
||||
explicit StartRemoteDialog(QWidget *parent = 0);
|
||||
~StartRemoteDialog() override;
|
||||
|
||||
QSsh::SshConnectionParameters sshParams() const;
|
||||
QUrl serverUrl() const;
|
||||
ProjectExplorer::StandardRunnable runnable() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -239,7 +239,6 @@ Project {
|
||||
"analyzermanager.h",
|
||||
"analyzerrunconfigwidget.cpp",
|
||||
"analyzerrunconfigwidget.h",
|
||||
"analyzerstartparameters.h",
|
||||
"analyzerutils.cpp",
|
||||
"analyzerutils.h",
|
||||
"detailederrorview.cpp",
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
|
||||
#include "analyzer/analyzerconstants.h"
|
||||
#include "analyzer/analyzermanager.h"
|
||||
#include "analyzer/analyzerstartparameters.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -3799,9 +3798,6 @@ QList<QObject *> DebuggerPlugin::createTestObjects() const
|
||||
#endif // if WITH_TESTS
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
void *AnalyzerConnection::staticTypeId = &AnalyzerConnection::staticTypeId;
|
||||
|
||||
} // namespace Debugger
|
||||
|
||||
#include "debuggerplugin.moc"
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "iosmanager.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/debuggerconstants.h>
|
||||
|
||||
#include <projectexplorer/customexecutablerunconfiguration.h>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "iossimulator.h"
|
||||
#include "iosconstants.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/debuggerplugin.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
@@ -367,10 +366,8 @@ IosAnalyzeSupport::IosAnalyzeSupport(RunControl *runControl)
|
||||
StandardRunnable runnable;
|
||||
runnable.executable = iosRunConfig->localExecutable().toUserOutput();
|
||||
runnable.commandLineArguments = iosRunConfig->commandLineArguments();
|
||||
Debugger::AnalyzerConnection connection;
|
||||
connection.analyzerHost = "localhost";
|
||||
runControl->setRunnable(runnable);
|
||||
runControl->setConnection(connection);
|
||||
runControl->setConnection(UrlConnection::localHostWithoutPort());
|
||||
runControl->setDisplayName(iosRunConfig->applicationName());
|
||||
|
||||
connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
#include "runnables.h"
|
||||
|
||||
#include <QTcpServer>
|
||||
|
||||
#include <utils/temporaryfile.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
bool operator==(const StandardRunnable &r1, const StandardRunnable &r2)
|
||||
@@ -37,4 +41,40 @@ bool operator==(const StandardRunnable &r1, const StandardRunnable &r2)
|
||||
|
||||
void *StandardRunnable::staticTypeId = &StandardRunnable::staticTypeId;
|
||||
|
||||
UrlConnection UrlConnection::fromHost(const QString &host)
|
||||
{
|
||||
UrlConnection connection;
|
||||
connection.setHost(host);
|
||||
return connection;
|
||||
}
|
||||
|
||||
UrlConnection UrlConnection::localHostWithoutPort()
|
||||
{
|
||||
QUrl serverUrl;
|
||||
QTcpServer server;
|
||||
serverUrl.setHost(server.serverAddress().toString());
|
||||
return UrlConnection(serverUrl);
|
||||
}
|
||||
|
||||
UrlConnection UrlConnection::localHostAndFreePort()
|
||||
{
|
||||
QUrl serverUrl;
|
||||
QTcpServer server;
|
||||
if (server.listen(QHostAddress::LocalHost) || server.listen(QHostAddress::LocalHostIPv6)) {
|
||||
serverUrl.setHost(server.serverAddress().toString());
|
||||
serverUrl.setPort(server.serverPort());
|
||||
}
|
||||
return UrlConnection(serverUrl);
|
||||
}
|
||||
|
||||
UrlConnection UrlConnection::localSocket()
|
||||
{
|
||||
QUrl serverUrl;
|
||||
serverUrl.setScheme(socketScheme());
|
||||
Utils::TemporaryFile file("qmlprofiler-freesocket");
|
||||
if (file.open())
|
||||
serverUrl.setPath(file.fileName());
|
||||
return UrlConnection(serverUrl);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -71,11 +71,12 @@ public:
|
||||
UrlConnection() {}
|
||||
explicit UrlConnection(const QUrl &url) : QUrl(url) {}
|
||||
|
||||
static UrlConnection fromHost(const QString &host) {
|
||||
UrlConnection connection;
|
||||
connection.setHost(host);
|
||||
return connection;
|
||||
}
|
||||
static UrlConnection fromHost(const QString &host);
|
||||
static UrlConnection localHostAndFreePort();
|
||||
static UrlConnection localHostWithoutPort();
|
||||
static UrlConnection localSocket();
|
||||
|
||||
static QString socketScheme() { return QLatin1String("socket"); }
|
||||
|
||||
static void *staticTypeId;
|
||||
};
|
||||
|
||||
@@ -65,23 +65,10 @@ void QmlProfilerClientManager::setRetryParams(int interval, int maxAttempts)
|
||||
m_maximumRetries = maxAttempts;
|
||||
}
|
||||
|
||||
void QmlProfilerClientManager::setTcpConnection(QString host, Utils::Port port)
|
||||
void QmlProfilerClientManager::setServerUrl(const QUrl &server)
|
||||
{
|
||||
if (!m_localSocket.isEmpty() || m_tcpHost != host || m_tcpPort != port) {
|
||||
m_tcpHost = host;
|
||||
m_tcpPort = port;
|
||||
m_localSocket.clear();
|
||||
disconnectClient();
|
||||
stopConnectionTimer();
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerClientManager::setLocalSocket(QString file)
|
||||
{
|
||||
if (m_localSocket != file || !m_tcpHost.isEmpty() || m_tcpPort.isValid()) {
|
||||
m_localSocket = file;
|
||||
m_tcpHost.clear();
|
||||
m_tcpPort = Utils::Port();
|
||||
if (m_server != server) {
|
||||
m_server = server;
|
||||
disconnectClient();
|
||||
stopConnectionTimer();
|
||||
}
|
||||
@@ -89,9 +76,7 @@ void QmlProfilerClientManager::setLocalSocket(QString file)
|
||||
|
||||
void QmlProfilerClientManager::clearConnection()
|
||||
{
|
||||
m_localSocket.clear();
|
||||
m_tcpHost.clear();
|
||||
m_tcpPort = Utils::Port();
|
||||
m_server.clear();
|
||||
disconnectClient();
|
||||
stopConnectionTimer();
|
||||
}
|
||||
@@ -115,7 +100,7 @@ void QmlProfilerClientManager::connectToTcpServer()
|
||||
if (m_connection.isNull()) {
|
||||
// If the previous connection failed, recreate it.
|
||||
createConnection();
|
||||
m_connection->connectToHost(m_tcpHost, m_tcpPort.number());
|
||||
m_connection->connectToHost(m_server.host(), m_server.port());
|
||||
} else if (m_numRetries < 3
|
||||
&& m_connection->socketState() != QAbstractSocket::ConnectedState) {
|
||||
// If we don't get connected in the first retry interval, drop the socket and try
|
||||
@@ -124,7 +109,7 @@ void QmlProfilerClientManager::connectToTcpServer()
|
||||
// On other operating systems (windows) every connection takes forever to get
|
||||
// established. So, after tearing down and rebuilding the socket twice, just
|
||||
// keep trying with the same one.
|
||||
m_connection->connectToHost(m_tcpHost, m_tcpPort.number());
|
||||
m_connection->connectToHost(m_server.host(), m_server.port());
|
||||
} // Else leave it alone and wait for hello.
|
||||
} else {
|
||||
// On final timeout, clear the connection.
|
||||
@@ -142,7 +127,7 @@ void QmlProfilerClientManager::connectToTcpServer()
|
||||
QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient());
|
||||
createConnection();
|
||||
QTC_ASSERT(m_connection, emit connectionFailed(); return);
|
||||
m_connection->connectToHost(m_tcpHost, m_tcpPort.number());
|
||||
m_connection->connectToHost(m_server.host(), m_server.port());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +154,7 @@ void QmlProfilerClientManager::startLocalServer()
|
||||
QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient());
|
||||
createConnection();
|
||||
QTC_ASSERT(m_connection, emit connectionFailed(); return);
|
||||
m_connection->startLocalServer(m_localSocket);
|
||||
m_connection->startLocalServer(m_server.path());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,9 +166,9 @@ void QmlProfilerClientManager::stopRecording()
|
||||
|
||||
void QmlProfilerClientManager::retryConnect()
|
||||
{
|
||||
if (!m_localSocket.isEmpty()) {
|
||||
if (m_server.scheme() == "socket") {
|
||||
startLocalServer();
|
||||
} else if (!m_tcpHost.isEmpty() && m_tcpPort.isValid()) {
|
||||
} else if (!m_server.host().isEmpty() && m_server.port() > -1) {
|
||||
disconnectClient();
|
||||
connectToTcpServer();
|
||||
} else {
|
||||
|
||||
@@ -28,12 +28,10 @@
|
||||
#include "qmlprofilertraceclient.h"
|
||||
|
||||
#include <qmldebug/qmldebugclient.h>
|
||||
#include <utils/port.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QUrl>
|
||||
|
||||
namespace QmlProfiler {
|
||||
class QmlProfilerModelManager;
|
||||
@@ -49,8 +47,7 @@ public:
|
||||
~QmlProfilerClientManager();
|
||||
|
||||
void setProfilerStateManager(QmlProfilerStateManager *profilerState);
|
||||
void setTcpConnection(QString host, Utils::Port port);
|
||||
void setLocalSocket(QString file);
|
||||
void setServerUrl(const QUrl &server);
|
||||
void clearConnection();
|
||||
|
||||
void clearBufferedData();
|
||||
@@ -79,9 +76,7 @@ private:
|
||||
|
||||
QTimer m_connectionTimer;
|
||||
|
||||
QString m_localSocket;
|
||||
QString m_tcpHost;
|
||||
Utils::Port m_tcpPort;
|
||||
QUrl m_server;
|
||||
quint32 m_flushInterval = 0;
|
||||
|
||||
int m_retryInterval = 200;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "qmlprofilerplugin.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
@@ -37,7 +36,6 @@
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/localapplicationruncontrol.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
@@ -51,15 +49,11 @@
|
||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/temporaryfile.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QTcpServer>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace Debugger;
|
||||
@@ -79,7 +73,7 @@ public:
|
||||
QmlProfilerStateManager *m_profilerState = 0;
|
||||
QTimer m_noDebugOutputTimer;
|
||||
bool m_isLocal = false;
|
||||
QmlProfilerRunner::Configuration m_configuration;
|
||||
QUrl m_serverUrl;
|
||||
ProjectExplorer::ApplicationLauncher m_launcher;
|
||||
QmlDebug::QmlOutputParser m_outputParser;
|
||||
};
|
||||
@@ -116,29 +110,24 @@ void QmlProfilerRunner::start()
|
||||
Internal::QmlProfilerTool::instance()->finalizeRunControl(this);
|
||||
QTC_ASSERT(d->m_profilerState, return);
|
||||
|
||||
QTC_ASSERT(connection().is<AnalyzerConnection>(), return);
|
||||
auto conn = connection().as<AnalyzerConnection>();
|
||||
QTC_ASSERT(connection().is<UrlConnection>(), return);
|
||||
QUrl serverUrl = connection().as<UrlConnection>();
|
||||
|
||||
if (conn.analyzerPort.isValid()) {
|
||||
if (serverUrl.port() != -1) {
|
||||
auto clientManager = Internal::QmlProfilerTool::clientManager();
|
||||
clientManager->setTcpConnection(conn.analyzerHost, conn.analyzerPort);
|
||||
clientManager->setServerUrl(serverUrl);
|
||||
clientManager->connectToTcpServer();
|
||||
}
|
||||
else if (conn.analyzerSocket.isEmpty())
|
||||
else if (serverUrl.path().isEmpty())
|
||||
d->m_noDebugOutputTimer.start();
|
||||
|
||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
|
||||
|
||||
if (d->m_isLocal) {
|
||||
QTC_ASSERT(!d->m_configuration.socket.isEmpty() || d->m_configuration.port.isValid(), return);
|
||||
QTC_ASSERT(!d->m_serverUrl.path().isEmpty() || d->m_serverUrl.port() != -1, return);
|
||||
|
||||
StandardRunnable debuggee = runnable().as<StandardRunnable>();
|
||||
QString arguments = d->m_configuration.socket.isEmpty() ?
|
||||
QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
|
||||
d->m_configuration.port) :
|
||||
QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlProfilerServices,
|
||||
d->m_configuration.socket);
|
||||
|
||||
QString arguments = QmlDebug::qmlDebugArguments(QmlDebug::QmlProfilerServices, d->m_serverUrl);
|
||||
|
||||
if (!debuggee.commandLineArguments.isEmpty())
|
||||
arguments += ' ' + debuggee.commandLineArguments;
|
||||
@@ -254,13 +243,15 @@ void QmlProfilerRunner::notifyRemoteSetupDone(Utils::Port port)
|
||||
{
|
||||
d->m_noDebugOutputTimer.stop();
|
||||
|
||||
if (!port.isValid()) {
|
||||
QTC_ASSERT(connection().is<AnalyzerConnection>(), return);
|
||||
port = connection().as<AnalyzerConnection>().analyzerPort;
|
||||
}
|
||||
QTC_ASSERT(connection().is<UrlConnection>(), return);
|
||||
QUrl serverUrl = connection().as<UrlConnection>();
|
||||
if (!port.isValid())
|
||||
port = Utils::Port(serverUrl.port());
|
||||
|
||||
if (port.isValid()) {
|
||||
serverUrl.setPort(port.number());
|
||||
auto clientManager = Internal::QmlProfilerTool::clientManager();
|
||||
clientManager->setTcpConnection(connection().as<AnalyzerConnection>().analyzerHost, port);
|
||||
clientManager->setServerUrl(serverUrl);
|
||||
clientManager->connectToTcpServer();
|
||||
}
|
||||
}
|
||||
@@ -291,33 +282,10 @@ void QmlProfilerRunner::profilerStateChanged()
|
||||
}
|
||||
}
|
||||
|
||||
QString QmlProfilerRunner::findFreeSocket()
|
||||
{
|
||||
Utils::TemporaryFile file("qmlprofiler-freesocket");
|
||||
if (file.open()) {
|
||||
return file.fileName();
|
||||
} else {
|
||||
qWarning() << "Could not open a temporary file to find a debug socket.";
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Port QmlProfilerRunner::findFreePort(QString &host)
|
||||
{
|
||||
QTcpServer server;
|
||||
if (!server.listen(QHostAddress::LocalHost)
|
||||
&& !server.listen(QHostAddress::LocalHostIPv6)) {
|
||||
qWarning() << "Cannot open port on host for QML profiling.";
|
||||
return Utils::Port();
|
||||
}
|
||||
host = server.serverAddress().toString();
|
||||
return Utils::Port(server.serverPort());
|
||||
}
|
||||
|
||||
void QmlProfilerRunner::setLocalConfiguration(const Configuration &configuration)
|
||||
void QmlProfilerRunner::setServerUrl(const QUrl &serverUrl)
|
||||
{
|
||||
d->m_isLocal = true;
|
||||
d->m_configuration = configuration;
|
||||
d->m_serverUrl = serverUrl;
|
||||
connect(&d->m_launcher, &ApplicationLauncher::appendMessage,
|
||||
this, &QmlProfilerRunner::appendMessage);
|
||||
connect(this, &QmlProfilerRunner::localRunnerStopped,
|
||||
|
||||
@@ -45,11 +45,7 @@ public:
|
||||
QmlProfilerRunner(ProjectExplorer::RunControl *runControl);
|
||||
~QmlProfilerRunner() override;
|
||||
|
||||
struct Configuration {
|
||||
Utils::Port port;
|
||||
QString socket;
|
||||
};
|
||||
void setLocalConfiguration(const Configuration &conf);
|
||||
void setServerUrl(const QUrl &serverUrl);
|
||||
|
||||
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
|
||||
|
||||
@@ -58,9 +54,6 @@ public:
|
||||
void cancelProcess();
|
||||
void notifyRemoteFinished();
|
||||
|
||||
static Utils::Port findFreePort(QString &host);
|
||||
static QString findFreeSocket();
|
||||
|
||||
signals:
|
||||
void localRunnerStarted();
|
||||
void localRunnerStopped();
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
@@ -74,27 +73,23 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
||||
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
|
||||
|
||||
Kit *kit = runConfiguration->target()->kit();
|
||||
AnalyzerConnection connection;
|
||||
QUrl serverUrl;
|
||||
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
||||
if (version) {
|
||||
if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0))
|
||||
connection.analyzerSocket = QmlProfilerRunner::findFreeSocket();
|
||||
serverUrl = UrlConnection::localSocket();
|
||||
else
|
||||
connection.analyzerPort = QmlProfilerRunner::findFreePort(connection.analyzerHost);
|
||||
serverUrl = UrlConnection::localHostAndFreePort();
|
||||
} else {
|
||||
qWarning() << "Running QML profiler on Kit without Qt version??";
|
||||
connection.analyzerPort = QmlProfilerRunner::findFreePort(connection.analyzerHost);
|
||||
qWarning("Running QML profiler on Kit without Qt version?");
|
||||
serverUrl = UrlConnection::localHostAndFreePort();
|
||||
}
|
||||
|
||||
auto runControl = new RunControl(runConfiguration, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setConnection(connection);
|
||||
|
||||
QmlProfilerRunner::Configuration conf;
|
||||
conf.socket = connection.analyzerSocket;
|
||||
conf.port = connection.analyzerPort;
|
||||
runControl->setConnection(UrlConnection(serverUrl));
|
||||
|
||||
auto runner = new QmlProfilerRunner(runControl);
|
||||
runner->setLocalConfiguration(conf);
|
||||
runner->setServerUrl(serverUrl);
|
||||
return runControl;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include <debugger/debuggericons.h>
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <utils/fancymainwindow.h>
|
||||
#include <utils/fileinprojectfinder.h>
|
||||
@@ -352,15 +351,14 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
||||
runWorker->registerProfilerStateManager(d->m_profilerState);
|
||||
QmlProfilerClientManager *clientManager = d->m_profilerConnections;
|
||||
|
||||
QTC_ASSERT(runWorker->connection().is<AnalyzerConnection>(), return);
|
||||
QTC_ASSERT(runWorker->connection().is<UrlConnection>(), return);
|
||||
// FIXME: Check that there's something sensible in sp.connParams
|
||||
auto connection = runWorker->connection().as<AnalyzerConnection>();
|
||||
if (!connection.analyzerSocket.isEmpty()) {
|
||||
clientManager->setLocalSocket(connection.analyzerSocket);
|
||||
auto serverUrl = runWorker->connection().as<UrlConnection>();
|
||||
clientManager->setServerUrl(serverUrl);
|
||||
if (!serverUrl.path().isEmpty()) {
|
||||
// That's the local socket case.
|
||||
// We open the server and the application connects to it, so let's do that right away.
|
||||
clientManager->startLocalServer();
|
||||
} else {
|
||||
clientManager->setTcpConnection(connection.analyzerHost, connection.analyzerPort);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -579,23 +577,21 @@ void QmlProfilerTool::startRemoteTool()
|
||||
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port);
|
||||
}
|
||||
|
||||
AnalyzerConnection connection;
|
||||
QUrl serverUrl;
|
||||
|
||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
if (device) {
|
||||
Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
|
||||
QTC_ASSERT(toolControl.is<HostName>(), return);
|
||||
connection.analyzerHost = toolControl.as<HostName>().host();
|
||||
connection.connParams = device->sshParameters();
|
||||
}
|
||||
connection.analyzerPort = Utils::Port(port);
|
||||
QTC_ASSERT(device, return);
|
||||
Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
|
||||
QTC_ASSERT(toolControl.is<HostName>(), return);
|
||||
serverUrl.setHost(toolControl.as<HostName>().host());
|
||||
serverUrl.setPort(port);
|
||||
|
||||
Debugger::selectPerspective(Constants::QmlProfilerPerspectiveId);
|
||||
|
||||
RunConfiguration *rc = Debugger::startupRunConfiguration();
|
||||
auto runControl = new RunControl(rc, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
runControl->setConnection(connection);
|
||||
runControl->setConnection(UrlConnection(serverUrl));
|
||||
|
||||
ProjectExplorerPlugin::startRunControl(runControl);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "../qmlprofilerruncontrol.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
@@ -63,13 +62,13 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
debuggee.environment = Utils::Environment::systemEnvironment();
|
||||
|
||||
// should not be used anywhere but cannot be empty
|
||||
configuration.socket = connection.analyzerSocket = QString("invalid");
|
||||
serverUrl.setPath("invalid");
|
||||
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(UrlConnection(serverUrl));
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
|
||||
rc->initiateStart();
|
||||
@@ -81,7 +80,7 @@ void LocalQmlProfilerRunnerTest::testRunner1()
|
||||
QTRY_COMPARE_WITH_TIMEOUT(runCount, 1, 10000);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
|
||||
|
||||
configuration.socket = connection.analyzerSocket = QmlProfilerRunner::findFreeSocket();
|
||||
serverUrl = UrlConnection::localSocket();
|
||||
|
||||
debuggee.executable = QCoreApplication::applicationFilePath();
|
||||
// comma is used to specify a test function. In this case, an invalid one.
|
||||
@@ -90,9 +89,9 @@ void LocalQmlProfilerRunnerTest::testRunner1()
|
||||
delete rc;
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(serverUrl);
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
rc->initiateStart();
|
||||
QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner2);
|
||||
@@ -106,15 +105,12 @@ void LocalQmlProfilerRunnerTest::testRunner2()
|
||||
delete rc;
|
||||
|
||||
debuggee.commandLineArguments.clear();
|
||||
configuration.socket.clear();
|
||||
connection.analyzerSocket.clear();
|
||||
configuration.port = connection.analyzerPort =
|
||||
QmlProfilerRunner::findFreePort(connection.analyzerHost);
|
||||
serverUrl = UrlConnection::localHostAndFreePort();
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(serverUrl);
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
rc->initiateStart();
|
||||
|
||||
@@ -136,17 +132,17 @@ void LocalQmlProfilerRunnerTest::testRunner4()
|
||||
|
||||
void LocalQmlProfilerRunnerTest::testFindFreePort()
|
||||
{
|
||||
QString host;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(host);
|
||||
QVERIFY(port.isValid());
|
||||
QVERIFY(!host.isEmpty());
|
||||
QUrl serverUrl = UrlConnection::localHostAndFreePort();
|
||||
QVERIFY(serverUrl.port() != -1);
|
||||
QVERIFY(!serverUrl.host().isEmpty());
|
||||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress(host), port.number()));
|
||||
QVERIFY(server.listen(QHostAddress(serverUrl.host()), serverUrl.port()));
|
||||
}
|
||||
|
||||
void LocalQmlProfilerRunnerTest::testFindFreeSocket()
|
||||
{
|
||||
QString socket = QmlProfilerRunner::findFreeSocket();
|
||||
QUrl serverUrl = UrlConnection::localSocket();
|
||||
QString socket = serverUrl.path();
|
||||
QVERIFY(!socket.isEmpty());
|
||||
QVERIFY(!QFile::exists(socket));
|
||||
QFile file(socket);
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
#include <qmlprofiler/qmlprofilermodelmanager.h>
|
||||
#include <qmlprofiler/qmlprofilerruncontrol.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
@@ -54,8 +55,7 @@ private:
|
||||
int runCount = 0;
|
||||
ProjectExplorer::RunControl *rc = nullptr;
|
||||
ProjectExplorer::StandardRunnable debuggee;
|
||||
Debugger::AnalyzerConnection connection;
|
||||
QmlProfilerRunner::Configuration configuration;
|
||||
ProjectExplorer::UrlConnection serverUrl;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
@@ -68,34 +70,41 @@ void QmlProfilerClientManagerTest::testConnectionFailure_data()
|
||||
QTest::addColumn<QmlProfilerStateManager *>("stateManager");
|
||||
QVarLengthArray<QmlProfilerStateManager *> stateManagers({nullptr, &stateManager});
|
||||
|
||||
QString hostName;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(hostName);
|
||||
QUrl localUrl = UrlConnection::localHostAndFreePort();
|
||||
|
||||
QTest::addColumn<QString>("host");
|
||||
QVarLengthArray<QString> hosts({"", "/-/|\\-\\|/-", hostName});
|
||||
|
||||
QTest::addColumn<Utils::Port>("port");
|
||||
QVarLengthArray<Utils::Port> ports({Utils::Port(), Utils::Port(5), port});
|
||||
|
||||
QTest::addColumn<QString>("socket");
|
||||
QVarLengthArray<QString> sockets({"", "/-/|\\-\\|/-", QmlProfilerRunner::findFreeSocket()});
|
||||
QTest::addColumn<QUrl>("serverUrl");
|
||||
QVarLengthArray<QString> hosts({"", "/-/|\\-\\|/-", localUrl.host()});
|
||||
QVarLengthArray<int> ports({-1, 5, localUrl.port()});
|
||||
QVarLengthArray<QString> sockets({"", "/-/|\\-\\|/-", UrlConnection::localSocket().path()});
|
||||
|
||||
foreach (QmlProfilerModelManager *modelManager, modelManagers) {
|
||||
foreach (QmlProfilerStateManager *stateManager, stateManagers) {
|
||||
foreach (QString host, hosts) {
|
||||
foreach (Utils::Port port, ports) {
|
||||
foreach (QString socket, sockets) {
|
||||
QString tag = QString::fromLatin1("%1, %2, %3, %4, %5")
|
||||
.arg(QLatin1String(modelManager ? "modelManager" : "<null>"))
|
||||
.arg(QLatin1String(stateManager ? "stateManager" : "<null>"))
|
||||
.arg(host.isEmpty() ? "<empty>" : host)
|
||||
.arg(port.isValid() ? port.number() : 0)
|
||||
.arg(socket.isEmpty() ? "<empty>" : socket);
|
||||
QTest::newRow(tag.toLatin1().constData())
|
||||
<< modelManager << stateManager << host << port << socket;
|
||||
}
|
||||
foreach (int port, ports) {
|
||||
QString tag = QString::fromLatin1("%1, %2, %3, %4, %5")
|
||||
.arg(QLatin1String(modelManager ? "modelManager" : "<null>"))
|
||||
.arg(QLatin1String(stateManager ? "stateManager" : "<null>"))
|
||||
.arg(host.isEmpty() ? "<empty>" : host)
|
||||
.arg(Utils::Port(port).isValid() ? port : 0)
|
||||
.arg("<empty>");
|
||||
QUrl url;
|
||||
url.setHost(host);
|
||||
url.setPort(port);
|
||||
QTest::newRow(tag.toLatin1().constData()) << modelManager << stateManager << url;
|
||||
}
|
||||
}
|
||||
foreach (QString socket, sockets) {
|
||||
QString tag = QString::fromLatin1("%1, %2, %3, %4, %5")
|
||||
.arg(QLatin1String(modelManager ? "modelManager" : "<null>"))
|
||||
.arg(QLatin1String(stateManager ? "stateManager" : "<null>"))
|
||||
.arg("<empty>")
|
||||
.arg(0)
|
||||
.arg(socket);
|
||||
QUrl url;
|
||||
url.setScheme(ProjectExplorer::UrlConnection::socketScheme());
|
||||
url.setPath(socket);
|
||||
QTest::newRow(tag.toLatin1().constData()) << modelManager << stateManager << url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,9 +127,7 @@ void QmlProfilerClientManagerTest::testConnectionFailure()
|
||||
|
||||
QFETCH(QmlProfilerModelManager *, modelManager);
|
||||
QFETCH(QmlProfilerStateManager *, stateManager);
|
||||
QFETCH(QString, host);
|
||||
QFETCH(Utils::Port, port);
|
||||
QFETCH(QString, socket);
|
||||
QFETCH(QUrl, serverUrl);
|
||||
|
||||
QSignalSpy openedSpy(&clientManager, SIGNAL(connectionOpened()));
|
||||
QSignalSpy closedSpy(&clientManager, SIGNAL(connectionClosed()));
|
||||
@@ -130,11 +137,7 @@ void QmlProfilerClientManagerTest::testConnectionFailure()
|
||||
|
||||
clientManager.setModelManager(modelManager);
|
||||
clientManager.setProfilerStateManager(stateManager);
|
||||
if (socket.isEmpty()) {
|
||||
clientManager.setTcpConnection(host, port);
|
||||
} else {
|
||||
clientManager.setLocalSocket(socket);
|
||||
}
|
||||
clientManager.setServerUrl(serverUrl);
|
||||
|
||||
QVERIFY(!clientManager.isConnected());
|
||||
|
||||
@@ -172,14 +175,13 @@ void QmlProfilerClientManagerTest::testUnresponsiveTcp()
|
||||
clientManager.setProfilerStateManager(&stateManager);
|
||||
clientManager.setModelManager(&modelManager);
|
||||
|
||||
QString hostName;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(hostName);
|
||||
QUrl serverUrl = UrlConnection::localHostAndFreePort();
|
||||
|
||||
QTcpServer server;
|
||||
server.listen(QHostAddress(hostName), port.number());
|
||||
server.listen(QHostAddress(serverUrl.host()), serverUrl.port());
|
||||
QSignalSpy connectionSpy(&server, SIGNAL(newConnection()));
|
||||
|
||||
clientManager.setTcpConnection(hostName, port);
|
||||
clientManager.setServerUrl(serverUrl);
|
||||
clientManager.connectToTcpServer();
|
||||
|
||||
QTRY_VERIFY(connectionSpy.count() > 0);
|
||||
@@ -202,14 +204,14 @@ void QmlProfilerClientManagerTest::testUnresponsiveLocal()
|
||||
clientManager.setProfilerStateManager(&stateManager);
|
||||
clientManager.setModelManager(&modelManager);
|
||||
|
||||
QString socketFile = QmlProfilerRunner::findFreeSocket();
|
||||
QUrl socketUrl = UrlConnection::localSocket();
|
||||
QLocalSocket socket;
|
||||
QSignalSpy connectionSpy(&socket, SIGNAL(connected()));
|
||||
|
||||
clientManager.setLocalSocket(socketFile);
|
||||
clientManager.setServerUrl(socketUrl);
|
||||
clientManager.startLocalServer();
|
||||
|
||||
socket.connectToServer(socketFile);
|
||||
socket.connectToServer(socketUrl.path());
|
||||
QTRY_COMPARE(connectionSpy.count(), 1);
|
||||
QTRY_COMPARE(failedSpy.count(), 1);
|
||||
QCOMPARE(openedSpy.count(), 0);
|
||||
@@ -254,8 +256,7 @@ void QmlProfilerClientManagerTest::testResponsiveTcp()
|
||||
{
|
||||
QFETCH(quint32, flushInterval);
|
||||
|
||||
QString hostName;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(hostName);
|
||||
QUrl serverUrl = UrlConnection::localHostAndFreePort();
|
||||
|
||||
QSignalSpy openedSpy(&clientManager, SIGNAL(connectionOpened()));
|
||||
QSignalSpy closedSpy(&clientManager, SIGNAL(connectionClosed()));
|
||||
@@ -270,7 +271,7 @@ void QmlProfilerClientManagerTest::testResponsiveTcp()
|
||||
fakeDebugServer(socket.data());
|
||||
});
|
||||
|
||||
server.listen(QHostAddress(hostName), port.number());
|
||||
server.listen(QHostAddress(serverUrl.host()), serverUrl.port());
|
||||
|
||||
clientManager.setProfilerStateManager(&stateManager);
|
||||
clientManager.setModelManager(&modelManager);
|
||||
@@ -279,7 +280,7 @@ void QmlProfilerClientManagerTest::testResponsiveTcp()
|
||||
connect(&clientManager, &QmlProfilerClientManager::connectionFailed,
|
||||
&clientManager, &QmlProfilerClientManager::retryConnect);
|
||||
|
||||
clientManager.setTcpConnection(hostName, port);
|
||||
clientManager.setServerUrl(serverUrl);
|
||||
clientManager.connectToTcpServer();
|
||||
|
||||
QTRY_COMPARE(openedSpy.count(), 1);
|
||||
@@ -314,7 +315,7 @@ void QmlProfilerClientManagerTest::testResponsiveLocal()
|
||||
{
|
||||
QFETCH(quint32, flushInterval);
|
||||
|
||||
QString socketFile = QmlProfilerRunner::findFreeSocket();
|
||||
QUrl socketUrl = UrlConnection::localSocket();
|
||||
|
||||
QSignalSpy openedSpy(&clientManager, SIGNAL(connectionOpened()));
|
||||
QSignalSpy closedSpy(&clientManager, SIGNAL(connectionClosed()));
|
||||
@@ -328,12 +329,12 @@ void QmlProfilerClientManagerTest::testResponsiveLocal()
|
||||
connect(&clientManager, &QmlProfilerClientManager::connectionFailed,
|
||||
&clientManager, &QmlProfilerClientManager::retryConnect);
|
||||
|
||||
clientManager.setLocalSocket(socketFile);
|
||||
clientManager.setServerUrl(socketUrl);
|
||||
clientManager.startLocalServer();
|
||||
|
||||
{
|
||||
QScopedPointer<QLocalSocket> socket(new QLocalSocket(this));
|
||||
socket->connectToServer(socketFile);
|
||||
socket->connectToServer(socketUrl.path());
|
||||
QVERIFY(socket->isOpen());
|
||||
fakeDebugServer(socket.data());
|
||||
|
||||
@@ -379,8 +380,7 @@ void QmlProfilerClientManagerTest::testInvalidData()
|
||||
clientManager.setProfilerStateManager(&stateManager);
|
||||
clientManager.setModelManager(&modelManager);
|
||||
|
||||
QString hostName;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(hostName);
|
||||
QUrl serverUrl = UrlConnection::localHostAndFreePort();
|
||||
|
||||
bool dataSent = false;
|
||||
QTcpServer server;
|
||||
@@ -395,9 +395,9 @@ void QmlProfilerClientManagerTest::testInvalidData()
|
||||
dataSent = true;
|
||||
});
|
||||
|
||||
server.listen(QHostAddress(hostName), port.number());
|
||||
server.listen(QHostAddress(serverUrl.host()), serverUrl.port());
|
||||
|
||||
clientManager.setTcpConnection(hostName, port);
|
||||
clientManager.setServerUrl(serverUrl);
|
||||
clientManager.connectToTcpServer();
|
||||
|
||||
QTRY_VERIFY(dataSent);
|
||||
@@ -411,7 +411,7 @@ void QmlProfilerClientManagerTest::testInvalidData()
|
||||
|
||||
void QmlProfilerClientManagerTest::testStopRecording()
|
||||
{
|
||||
QString socketFile = QmlProfilerRunner::findFreeSocket();
|
||||
QUrl socketUrl = UrlConnection::localSocket();
|
||||
|
||||
{
|
||||
QmlProfilerClientManager clientManager;
|
||||
@@ -427,11 +427,11 @@ void QmlProfilerClientManagerTest::testStopRecording()
|
||||
connect(&clientManager, &QmlProfilerClientManager::connectionFailed,
|
||||
&clientManager, &QmlProfilerClientManager::retryConnect);
|
||||
|
||||
clientManager.setLocalSocket(socketFile);
|
||||
clientManager.setServerUrl(socketUrl);
|
||||
clientManager.startLocalServer();
|
||||
|
||||
QScopedPointer<QLocalSocket> socket(new QLocalSocket(this));
|
||||
socket->connectToServer(socketFile);
|
||||
socket->connectToServer(socketUrl.path());
|
||||
QVERIFY(socket->isOpen());
|
||||
fakeDebugServer(socket.data());
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <debugger/debuggerconstants.h>
|
||||
#include <debugger/analyzer/analyzerconstants.h>
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/analyzer/analyzerutils.h>
|
||||
#include <debugger/analyzer/startremotedialog.h>
|
||||
|
||||
@@ -293,9 +292,7 @@ CallgrindTool::CallgrindTool(QObject *parent)
|
||||
auto runControl = new RunControl(runConfig, CALLGRIND_RUN_MODE);
|
||||
const auto runnable = dlg.runnable();
|
||||
runControl->setRunnable(runnable);
|
||||
AnalyzerConnection connection;
|
||||
connection.connParams = dlg.sshParams();
|
||||
runControl->setConnection(connection);
|
||||
runControl->setConnection(UrlConnection(dlg.serverUrl()));
|
||||
runControl->setDisplayName(runnable.executable);
|
||||
createRunTool(runControl);
|
||||
ProjectExplorerPlugin::startRunControl(runControl);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include <debugger/analyzer/analyzerconstants.h>
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
#include <debugger/analyzer/analyzerutils.h>
|
||||
#include <debugger/analyzer/startremotedialog.h>
|
||||
|
||||
@@ -456,9 +455,7 @@ MemcheckTool::MemcheckTool(QObject *parent)
|
||||
rc->createWorker(MEMCHECK_RUN_MODE);
|
||||
const auto runnable = dlg.runnable();
|
||||
rc->setRunnable(runnable);
|
||||
AnalyzerConnection connection;
|
||||
connection.connParams = dlg.sshParams();
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(UrlConnection(dlg.serverUrl()));
|
||||
rc->setDisplayName(runnable.executable);
|
||||
ProjectExplorerPlugin::startRunControl(rc);
|
||||
});
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "valgrindplugin.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
|
||||
Reference in New Issue
Block a user