Commit a14e7db1 authored by Christian Kandeler's avatar Christian Kandeler

Fix valgrind with remote Linux hosts.

This reverts commit f1ccad12 and adds the necessary code to make both
the local and the remote case work.

Task-number: QTCREATORBUG-16153
Change-Id: I233ec9d7b31ca6e076515dd03ae7400758ee0c34
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent b688d18d
......@@ -95,10 +95,11 @@ bool MemcheckRunner::start()
{
QTC_ASSERT(d->parser, return false);
if (!startServers())
return false;
setValgrindArguments(memcheckLogArguments() + valgrindArguments());
if (device()->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (!startServers(QHostAddress::LocalHost))
return false;
setValgrindArguments(memcheckLogArguments() + valgrindArguments());
}
return ValgrindRunner::start();
}
......@@ -133,10 +134,8 @@ void MemcheckRunner::readLogSocket()
emit logMessageReceived(d->logSocket->readAll());
}
bool MemcheckRunner::startServers()
bool MemcheckRunner::startServers(const QHostAddress &localHostAddress)
{
QHostAddress localHostAddress(QHostAddress::LocalHost);
bool check = d->xmlServer.listen(localHostAddress);
const QString ip = localHostAddress.toString();
if (!check) {
......@@ -172,5 +171,13 @@ QStringList MemcheckRunner::memcheckLogArguments() const
return arguments;
}
void MemcheckRunner::localHostAddressRetrieved(const QHostAddress &localHostAddress)
{
if (startServers(localHostAddress)) {
setValgrindArguments(memcheckLogArguments() + valgrindArguments());
valgrindProcess()->setValgrindArguments(fullValgrindArguments());
}
}
} // namespace Memcheck
} // namespace Valgrind
......@@ -53,6 +53,8 @@ signals:
void logMessageReceived(const QByteArray &);
private slots:
void localHostAddressRetrieved(const QHostAddress &localHostAddress);
void xmlSocketConnected();
void logSocketConnected();
void readLogSocket();
......@@ -60,7 +62,7 @@ private slots:
private:
QString tool() const;
bool startServers();
bool startServers(const QHostAddress &localHostAddress);
QStringList memcheckLogArguments() const;
class Private;
......
......@@ -205,6 +205,8 @@ void ValgrindProcess::connected()
{
QTC_ASSERT(m_remote.m_connection->state() == QSsh::SshConnection::Connected, return);
emit localHostAddressRetrieved(m_remote.m_connection->connectionInfo().localAddress);
// connected, run command
QString cmd;
......
......@@ -75,6 +75,7 @@ signals:
void finished(int, QProcess::ExitStatus);
void error(QProcess::ProcessError);
void processOutput(const QString &, Utils::OutputFormat format);
void localHostAddressRetrieved(const QHostAddress &localHostAddress);
private:
void handleRemoteStderr();
......
......@@ -147,6 +147,8 @@ bool ValgrindRunner::start()
this, &ValgrindRunner::processFinished);
QObject::connect(d->process, &ValgrindProcess::error,
this, &ValgrindRunner::processError);
QObject::connect(d->process, &ValgrindProcess::localHostAddressRetrieved,
this, &ValgrindRunner::localHostAddressRetrieved);
d->process->run(d->debuggee.runMode);
return true;
......@@ -178,6 +180,11 @@ void ValgrindRunner::processFinished(int ret, QProcess::ExitStatus status)
emit processErrorReceived(errorString(), d->process->processError());
}
void ValgrindRunner::localHostAddressRetrieved(const QHostAddress &localHostAddress)
{
Q_UNUSED(localHostAddress);
}
QString ValgrindRunner::errorString() const
{
if (d->process)
......
......@@ -80,6 +80,7 @@ signals:
protected slots:
virtual void processError(QProcess::ProcessError);
virtual void processFinished(int, QProcess::ExitStatus);
virtual void localHostAddressRetrieved(const QHostAddress &localHostAddress);
private:
class Private;
......
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