Commit 0ffbb5a0 authored by hjk's avatar hjk

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: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent 678d1424
......@@ -94,7 +94,7 @@ void CallgrindController::run(Option option)
QTC_ASSERT(m_valgrindProc, return);
QSsh::SshConnection *connection = m_valgrindProc->connection();
m_process = new ValgrindProcess(m_valgrindProc->isLocal(),
m_process = new ValgrindProcess(
connection ? connection->connectionParameters() : QSsh::SshConnectionParameters(),
connection, this);
......
......@@ -37,13 +37,11 @@ using namespace ProjectExplorer;
namespace Valgrind {
ValgrindProcess::ValgrindProcess(bool isLocal, const QSsh::SshConnectionParameters &sshParams,
ValgrindProcess::ValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
QSsh::SshConnection *connection, QObject *parent)
: QObject(parent),
m_isLocal(isLocal)
: QObject(parent)
{
m_isLocal = sshParams.host.isEmpty();
m_remote.m_params = sshParams;
m_params = sshParams;
m_remote.m_connection = connection;
m_remote.m_error = QProcess::UnknownError;
m_pid = 0;
......@@ -129,7 +127,7 @@ void ValgrindProcess::run()
} else {
// connect to host and wait for 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) {
connect(m_remote.m_connection, &QSsh::SshConnection::connected,
......@@ -227,6 +225,11 @@ QSsh::SshConnection *ValgrindProcess::connection() const
return m_remote.m_connection;
}
bool ValgrindProcess::isLocal() const
{
return m_params.host.isEmpty();
}
void ValgrindProcess::localProcessStarted()
{
m_pid = m_localProcess.applicationPID();
......
......@@ -45,8 +45,8 @@ class ValgrindProcess : public QObject
Q_OBJECT
public:
ValgrindProcess(bool isLocal, const QSsh::SshConnectionParameters &sshParams,
QSsh::SshConnection *connection = 0, QObject *parent = 0);
ValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
QSsh::SshConnection *connection, QObject *parent);
bool isRunning() const;
......@@ -65,7 +65,7 @@ public:
qint64 pid() const;
QSsh::SshConnection *connection() const;
bool isLocal() const { return m_isLocal; }
bool isLocal() const;
signals:
void started();
......@@ -92,7 +92,6 @@ private:
qint64 m_pid;
struct Remote {
QSsh::SshConnectionParameters m_params;
QSsh::SshConnection *m_connection;
QSsh::SshRemoteProcess::Ptr m_process;
QString m_errorString;
......@@ -100,9 +99,9 @@ private:
QSsh::SshRemoteProcess::Ptr m_findPID;
} m_remote;
QSsh::SshConnectionParameters m_params;
QString m_valgrindExecutable;
QStringList m_valgrindArguments;
bool m_isLocal;
};
} // namespace Valgrind
......
......@@ -182,7 +182,7 @@ void ValgrindRunner::waitForFinished() const
bool ValgrindRunner::start()
{
// 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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment