forked from qt-creator/qt-creator
Valgrind: Do not start valgrind if it does not exist
...and print a warning with some user hint inside the application output instead. Drive-by fix: silence a soft assert in case of a failed start of callgrind. Fixes: QTCREATORBUG-28988 Change-Id: I4fd0253e1f18489031e2f6cfa276c4df5ea4483a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -258,7 +258,8 @@ void CallgrindToolRunner::triggerParse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto afterCopy = [this](expected_str<void> res) {
|
const auto afterCopy = [this](expected_str<void> res) {
|
||||||
QTC_ASSERT_EXPECTED(res, return);
|
if (!res) // failed to run callgrind
|
||||||
|
return;
|
||||||
showStatusMessage(Tr::tr("Parsing Profile Data..."));
|
showStatusMessage(Tr::tr("Parsing Profile Data..."));
|
||||||
m_parser.parse(m_hostOutputFile);
|
m_parser.parse(m_hostOutputFile);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "valgrindengine.h"
|
#include "valgrindengine.h"
|
||||||
#include "valgrindrunner.h"
|
#include "valgrindrunner.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "valgrindsettings.h"
|
|
||||||
#include "valgrindtr.h"
|
#include "valgrindtr.h"
|
||||||
|
|
||||||
#include "xmlprotocol/error.h"
|
#include "xmlprotocol/error.h"
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#define VALGRIND_DEBUG_OUTPUT 0
|
|
||||||
|
|
||||||
using namespace Debugger;
|
using namespace Debugger;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -55,6 +53,16 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
|
|||||||
|
|
||||||
void ValgrindToolRunner::start()
|
void ValgrindToolRunner::start()
|
||||||
{
|
{
|
||||||
|
FilePath valgrindExecutable = m_settings.valgrindExecutable.filePath();
|
||||||
|
if (IDevice::ConstPtr dev = DeviceKitAspect::device(runControl()->kit()))
|
||||||
|
valgrindExecutable = dev->filePath(valgrindExecutable.path());
|
||||||
|
if (!valgrindExecutable.isExecutableFile()) {
|
||||||
|
reportFailure(Tr::tr("Valgrind executable \"%1\" not found or not executable.\n"
|
||||||
|
"Check settings or ensure valgrind is installed and available in PATH.")
|
||||||
|
.arg(valgrindExecutable.toUserOutput()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
|
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
|
||||||
connect(fp, &FutureProgress::canceled,
|
connect(fp, &FutureProgress::canceled,
|
||||||
this, &ValgrindToolRunner::handleProgressCanceled);
|
this, &ValgrindToolRunner::handleProgressCanceled);
|
||||||
@@ -62,17 +70,6 @@ void ValgrindToolRunner::start()
|
|||||||
this, &ValgrindToolRunner::handleProgressFinished);
|
this, &ValgrindToolRunner::handleProgressFinished);
|
||||||
m_progress.reportStarted();
|
m_progress.reportStarted();
|
||||||
|
|
||||||
#if VALGRIND_DEBUG_OUTPUT
|
|
||||||
emit outputReceived(Tr::tr("Valgrind options: %1").arg(toolArguments().join(' ')), LogMessageFormat);
|
|
||||||
emit outputReceived(Tr::tr("Working directory: %1").arg(runnable().workingDirectory), LogMessageFormat);
|
|
||||||
emit outputReceived(Tr::tr("Command line arguments: %1").arg(runnable().debuggeeArgs), LogMessageFormat);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
FilePath valgrindExecutable = m_settings.valgrindExecutable.filePath();
|
|
||||||
if (IDevice::ConstPtr dev = DeviceKitAspect::device(runControl()->kit()))
|
|
||||||
valgrindExecutable = dev->filePath(valgrindExecutable.path());
|
|
||||||
|
|
||||||
CommandLine valgrind{valgrindExecutable};
|
CommandLine valgrind{valgrindExecutable};
|
||||||
valgrind.addArgs(m_settings.valgrindArguments.value(), CommandLine::Raw);
|
valgrind.addArgs(m_settings.valgrindArguments.value(), CommandLine::Raw);
|
||||||
valgrind.addArgs(genericToolArguments());
|
valgrind.addArgs(genericToolArguments());
|
||||||
|
|||||||
Reference in New Issue
Block a user