From aa52cfa0e6745d517b11c85a013a35f9712257f5 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 25 Apr 2014 12:19:48 +0200 Subject: 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 --- src/plugins/valgrind/valgrindprocess.cpp | 46 +++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'src/plugins/valgrind/valgrindprocess.cpp') diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp index 0a9f9d3281..7231353abb 100644 --- a/src/plugins/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrindprocess.cpp @@ -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; +} + /////////// -- cgit v1.2.1