Valgrind: Remove dialog asking for IP address.

When running the memcheck tool remotely, it sends its data via a TCP
socket to the development host, so it needs to know that machine's IP
address. The current code gathers all local network addresses and makes
the user choose one of them. However, we can get that information from
the SSH connection, so no user interaction is required.

Change-Id: Ia61decddd5fa1e285ca143605d944d6d9275b3e4
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Christian Kandeler
2014-04-25 12:19:48 +02:00
committed by hjk
parent 9c24a673de
commit aa52cfa0e6
7 changed files with 130 additions and 113 deletions

View File

@@ -79,6 +79,26 @@ bool ValgrindProcess::isRunning() const
return m_remote.m_process && m_remote.m_process->isRunning();
}
void ValgrindProcess::setValgrindExecutable(const QString &valgrindExecutable)
{
m_valgrindExecutable = valgrindExecutable;
}
void ValgrindProcess::setValgrindArguments(const QStringList &valgrindArguments)
{
m_valgrindArguments = valgrindArguments;
}
void ValgrindProcess::setDebuggeeExecutable(const QString &debuggeeExecutable)
{
m_debuggeeExecutable = debuggeeExecutable;
}
void ValgrindProcess::setDebugeeArguments(const QString &debuggeeArguments)
{
m_debuggeeArguments = debuggeeArguments;
}
void ValgrindProcess::setEnvironment(const Utils::Environment &environment)
{
if (isLocal())
@@ -108,13 +128,8 @@ void ValgrindProcess::close()
}
}
void ValgrindProcess::run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
const QString &debuggeeExecutable, const QString &debuggeeArguments)
void ValgrindProcess::run()
{
Utils::QtcProcess::addArgs(&m_arguments, valgrindArguments);
Utils::QtcProcess::addArg(&m_arguments, debuggeeExecutable);
Utils::QtcProcess::addArgs(&m_arguments, debuggeeArguments);
if (isLocal()) {
connect(&m_localProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SIGNAL(finished(int,QProcess::ExitStatus)));
@@ -127,13 +142,14 @@ void ValgrindProcess::run(const QString &valgrindExecutable, const QStringList &
connect(&m_localProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(handleReadyReadStandardOutput()));
m_localProcess.setCommand(valgrindExecutable, m_arguments);
m_localProcess.setCommand(m_valgrindExecutable,
argumentString(Utils::HostOsInfo::hostOs()));
m_localProcess.start();
m_localProcess.waitForStarted();
m_pid = Utils::qPidToPid(m_localProcess.pid());
} else {
m_remote.m_valgrindExe = valgrindExecutable;
m_remote.m_debuggee = debuggeeExecutable;
m_remote.m_valgrindExe = m_valgrindExecutable;
m_remote.m_debuggee = m_debuggeeExecutable;
// connect to host and wait for connection
if (!m_remote.m_connection)
@@ -215,13 +231,15 @@ 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;
if (!m_remote.m_workingDir.isEmpty())
cmd += QString::fromLatin1("cd '%1' && ").arg(m_remote.m_workingDir);
cmd += m_remote.m_valgrindExe + QLatin1Char(' ') + m_arguments;
cmd += m_remote.m_valgrindExe + QLatin1Char(' ') + argumentString(Utils::OsTypeLinux);
m_remote.m_process = m_remote.m_connection->createRemoteProcess(cmd.toUtf8());
connect(m_remote.m_process.data(), SIGNAL(readyReadStandardError()),
@@ -287,6 +305,14 @@ void ValgrindProcess::findPIDOutputReceived()
}
}
QString ValgrindProcess::argumentString(Utils::OsType osType) const
{
QString arguments = Utils::QtcProcess::joinArgs(m_valgrindArguments, osType);
Utils::QtcProcess::addArg(&arguments, m_debuggeeExecutable, osType);
Utils::QtcProcess::addArg(&arguments, m_debuggeeArguments, osType);
return arguments;
}
///////////