forked from qt-creator/qt-creator
Valgrind: Postpone the decision on whether its a local run
The decision is wrong anyway, no harm done. Move it closer to a location where it can be done correctly. Change-Id: I92de8ffec92cae6b3de3322d5045b696ae62932f Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -94,7 +94,7 @@ void CallgrindController::run(Option option)
|
|||||||
QTC_ASSERT(m_valgrindProc, return);
|
QTC_ASSERT(m_valgrindProc, return);
|
||||||
|
|
||||||
QSsh::SshConnection *connection = m_valgrindProc->connection();
|
QSsh::SshConnection *connection = m_valgrindProc->connection();
|
||||||
m_process = new ValgrindProcess(m_valgrindProc->isLocal(),
|
m_process = new ValgrindProcess(
|
||||||
connection ? connection->connectionParameters() : QSsh::SshConnectionParameters(),
|
connection ? connection->connectionParameters() : QSsh::SshConnectionParameters(),
|
||||||
connection, this);
|
connection, this);
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,11 @@ using namespace ProjectExplorer;
|
|||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
|
|
||||||
ValgrindProcess::ValgrindProcess(bool isLocal, const QSsh::SshConnectionParameters &sshParams,
|
ValgrindProcess::ValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
|
||||||
QSsh::SshConnection *connection, QObject *parent)
|
QSsh::SshConnection *connection, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent)
|
||||||
m_isLocal(isLocal)
|
|
||||||
{
|
{
|
||||||
m_isLocal = sshParams.host.isEmpty();
|
m_params = sshParams;
|
||||||
m_remote.m_params = sshParams;
|
|
||||||
m_remote.m_connection = connection;
|
m_remote.m_connection = connection;
|
||||||
m_remote.m_error = QProcess::UnknownError;
|
m_remote.m_error = QProcess::UnknownError;
|
||||||
m_pid = 0;
|
m_pid = 0;
|
||||||
@@ -129,7 +127,7 @@ void ValgrindProcess::run()
|
|||||||
} else {
|
} else {
|
||||||
// connect to host and wait for connection
|
// connect to host and wait for connection
|
||||||
if (!m_remote.m_connection)
|
if (!m_remote.m_connection)
|
||||||
m_remote.m_connection = new QSsh::SshConnection(m_remote.m_params, this);
|
m_remote.m_connection = new QSsh::SshConnection(m_params, this);
|
||||||
|
|
||||||
if (m_remote.m_connection->state() != QSsh::SshConnection::Connected) {
|
if (m_remote.m_connection->state() != QSsh::SshConnection::Connected) {
|
||||||
connect(m_remote.m_connection, &QSsh::SshConnection::connected,
|
connect(m_remote.m_connection, &QSsh::SshConnection::connected,
|
||||||
@@ -227,6 +225,11 @@ QSsh::SshConnection *ValgrindProcess::connection() const
|
|||||||
return m_remote.m_connection;
|
return m_remote.m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValgrindProcess::isLocal() const
|
||||||
|
{
|
||||||
|
return m_params.host.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
void ValgrindProcess::localProcessStarted()
|
void ValgrindProcess::localProcessStarted()
|
||||||
{
|
{
|
||||||
m_pid = m_localProcess.applicationPID();
|
m_pid = m_localProcess.applicationPID();
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class ValgrindProcess : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ValgrindProcess(bool isLocal, const QSsh::SshConnectionParameters &sshParams,
|
ValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
|
||||||
QSsh::SshConnection *connection = 0, QObject *parent = 0);
|
QSsh::SshConnection *connection, QObject *parent);
|
||||||
|
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
qint64 pid() const;
|
qint64 pid() const;
|
||||||
QSsh::SshConnection *connection() const;
|
QSsh::SshConnection *connection() const;
|
||||||
bool isLocal() const { return m_isLocal; }
|
bool isLocal() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void started();
|
void started();
|
||||||
@@ -92,7 +92,6 @@ private:
|
|||||||
qint64 m_pid;
|
qint64 m_pid;
|
||||||
|
|
||||||
struct Remote {
|
struct Remote {
|
||||||
QSsh::SshConnectionParameters m_params;
|
|
||||||
QSsh::SshConnection *m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSsh::SshRemoteProcess::Ptr m_process;
|
QSsh::SshRemoteProcess::Ptr m_process;
|
||||||
QString m_errorString;
|
QString m_errorString;
|
||||||
@@ -100,9 +99,9 @@ private:
|
|||||||
QSsh::SshRemoteProcess::Ptr m_findPID;
|
QSsh::SshRemoteProcess::Ptr m_findPID;
|
||||||
} m_remote;
|
} m_remote;
|
||||||
|
|
||||||
|
QSsh::SshConnectionParameters m_params;
|
||||||
QString m_valgrindExecutable;
|
QString m_valgrindExecutable;
|
||||||
QStringList m_valgrindArguments;
|
QStringList m_valgrindArguments;
|
||||||
bool m_isLocal;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Valgrind
|
} // namespace Valgrind
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ void ValgrindRunner::waitForFinished() const
|
|||||||
bool ValgrindRunner::start()
|
bool ValgrindRunner::start()
|
||||||
{
|
{
|
||||||
// FIXME: This wrongly uses "useStartupProject" for a Local/Remote decision.
|
// FIXME: This wrongly uses "useStartupProject" for a Local/Remote decision.
|
||||||
d->run(new ValgrindProcess(d->useStartupProject, d->connParams, 0, this));
|
d->run(new ValgrindProcess(d->connParams, 0, this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user