forked from qt-creator/qt-creator
ValgrindRunner: Remove ValgrindRunner::setDevice
The device can now be determined from the debuggee's file path. Change-Id: I2b24d6e325f74826a644d02a9e418576c4e9b436 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "valgrindengine.h"
|
#include "valgrindengine.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "valgrindplugin.h"
|
|
||||||
|
|
||||||
#include <debugger/analyzer/analyzermanager.h>
|
#include <debugger/analyzer/analyzermanager.h>
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ void ValgrindToolRunner::start()
|
|||||||
valgrind.addArgs(toolArguments());
|
valgrind.addArgs(toolArguments());
|
||||||
|
|
||||||
m_runner.setValgrindCommand(valgrind);
|
m_runner.setValgrindCommand(valgrind);
|
||||||
m_runner.setDevice(device());
|
|
||||||
m_runner.setDebuggee(runControl()->runnable());
|
m_runner.setDebuggee(runControl()->runnable());
|
||||||
|
|
||||||
if (auto aspect = runControl()->aspect<TerminalAspect>())
|
if (auto aspect = runControl()->aspect<TerminalAspect>())
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "xmlprotocol/stack.h"
|
#include "xmlprotocol/stack.h"
|
||||||
#include "xmlprotocol/suppression.h"
|
#include "xmlprotocol/suppression.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
@@ -483,8 +482,6 @@ void ValgrindMemcheckParserTest::testParserStop()
|
|||||||
"-i", dataFile("memcheck-output-sample1.xml"), "--wait", "5" }});
|
"-i", dataFile("memcheck-output-sample1.xml"), "--wait", "5" }});
|
||||||
runner.setProcessChannelMode(QProcess::ForwardedChannels);
|
runner.setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
|
|
||||||
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
|
|
||||||
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));
|
|
||||||
runner.start();
|
runner.start();
|
||||||
QTest::qWait(500);
|
QTest::qWait(500);
|
||||||
runner.stop();
|
runner.stop();
|
||||||
@@ -505,8 +502,6 @@ void ValgrindMemcheckParserTest::testRealValgrind()
|
|||||||
ValgrindRunner runner;
|
ValgrindRunner runner;
|
||||||
runner.setValgrindCommand({"valgrind", {}});
|
runner.setValgrindCommand({"valgrind", {}});
|
||||||
runner.setDebuggee(debuggee);
|
runner.setDebuggee(debuggee);
|
||||||
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
|
|
||||||
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));
|
|
||||||
RunnerDumper dumper(&runner);
|
RunnerDumper dumper(&runner);
|
||||||
runner.start();
|
runner.start();
|
||||||
runner.waitForFinished();
|
runner.waitForFinished();
|
||||||
@@ -544,8 +539,6 @@ void ValgrindMemcheckParserTest::testValgrindStartError()
|
|||||||
ValgrindRunner runner;
|
ValgrindRunner runner;
|
||||||
runner.setValgrindCommand({FilePath::fromString(valgrindExe), valgrindArgs});
|
runner.setValgrindCommand({FilePath::fromString(valgrindExe), valgrindArgs});
|
||||||
runner.setDebuggee(debuggeeExecutable);
|
runner.setDebuggee(debuggeeExecutable);
|
||||||
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
|
|
||||||
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));
|
|
||||||
RunnerDumper dumper(&runner);
|
RunnerDumper dumper(&runner);
|
||||||
runner.start();
|
runner.start();
|
||||||
runner.waitForFinished();
|
runner.waitForFinished();
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "xmlprotocol/threadedparser.h"
|
#include "xmlprotocol/threadedparser.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
@@ -58,7 +57,6 @@ public:
|
|||||||
ValgrindRunner *q;
|
ValgrindRunner *q;
|
||||||
Runnable m_debuggee;
|
Runnable m_debuggee;
|
||||||
QtcProcess m_valgrindProcess;
|
QtcProcess m_valgrindProcess;
|
||||||
IDevice::ConstPtr m_device;
|
|
||||||
|
|
||||||
QtcProcess m_findPID;
|
QtcProcess m_findPID;
|
||||||
|
|
||||||
@@ -187,15 +185,19 @@ void ValgrindRunner::Private::remoteProcessStarted()
|
|||||||
QString procEscaped = proc;
|
QString procEscaped = proc;
|
||||||
procEscaped.replace("/", "\\\\/");
|
procEscaped.replace("/", "\\\\/");
|
||||||
|
|
||||||
CommandLine cmd(m_device->filePath("/bin/sh"), {});
|
const FilePath debuggee = m_debuggee.command.executable();
|
||||||
|
const CommandLine cmd(
|
||||||
|
debuggee.withNewPath("/bin/sh"),
|
||||||
// sleep required since otherwise we might only match "bash -c..." and not the actual
|
// sleep required since otherwise we might only match "bash -c..." and not the actual
|
||||||
// valgrind run
|
// valgrind run
|
||||||
cmd.setArguments(QString("-c \""
|
QString("-c \""
|
||||||
"sleep 1; ps ax" // list all processes with aliased name
|
"sleep 1; ps ax" // list all processes with aliased name
|
||||||
" | grep '%1.*%2'" // find valgrind process that runs with our exec
|
" | grep '%1.*%2'" // find valgrind process that runs with our exec
|
||||||
" | awk '\\$5 ~ /^%3/" // 5th column must start with valgrind process
|
" | awk '\\$5 ~ /^%3/" // 5th column must start with valgrind process
|
||||||
" {print \\$1;}'" // print 1st then (with PID)
|
" {print \\$1;}'" // print 1st then (with PID)
|
||||||
"\"").arg(proc, m_debuggee.command.executable().fileName(), procEscaped));
|
"\"").arg(proc, debuggee.fileName(), procEscaped),
|
||||||
|
CommandLine::Raw
|
||||||
|
);
|
||||||
|
|
||||||
m_findPID.setCommand(cmd);
|
m_findPID.setCommand(cmd);
|
||||||
|
|
||||||
@@ -264,11 +266,6 @@ void ValgrindRunner::setLocalServerAddress(const QHostAddress &localServerAddres
|
|||||||
d->localServerAddress = localServerAddress;
|
d->localServerAddress = localServerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindRunner::setDevice(const IDevice::ConstPtr &device)
|
|
||||||
{
|
|
||||||
d->m_device = device;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindRunner::setUseTerminal(bool on)
|
void ValgrindRunner::setUseTerminal(bool on)
|
||||||
{
|
{
|
||||||
d->m_valgrindProcess.setTerminalMode(on ? TerminalMode::On : TerminalMode::Off);
|
d->m_valgrindProcess.setTerminalMode(on ? TerminalMode::On : TerminalMode::Off);
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public:
|
|||||||
void setDebuggee(const ProjectExplorer::Runnable &debuggee);
|
void setDebuggee(const ProjectExplorer::Runnable &debuggee);
|
||||||
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
|
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
|
||||||
void setLocalServerAddress(const QHostAddress &localServerAddress);
|
void setLocalServerAddress(const QHostAddress &localServerAddress);
|
||||||
void setDevice(const ProjectExplorer::IDeviceConstPtr &device);
|
|
||||||
void setUseTerminal(bool on);
|
void setUseTerminal(bool on);
|
||||||
|
|
||||||
void waitForFinished() const;
|
void waitForFinished() const;
|
||||||
|
|||||||
@@ -91,8 +91,6 @@ QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStri
|
|||||||
m_runner->setLocalServerAddress(QHostAddress::LocalHost);
|
m_runner->setLocalServerAddress(QHostAddress::LocalHost);
|
||||||
m_runner->setValgrindCommand(valgrind);
|
m_runner->setValgrindCommand(valgrind);
|
||||||
m_runner->setDebuggee(debuggee);
|
m_runner->setDebuggee(debuggee);
|
||||||
m_runner->setDevice(DeviceManager::instance()->defaultDevice(
|
|
||||||
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));
|
|
||||||
m_runner->start();
|
m_runner->start();
|
||||||
m_runner->waitForFinished();
|
m_runner->waitForFinished();
|
||||||
return binPath;
|
return binPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user