ValgrindProcess: Inline setupValgrindProcess

Change-Id: I60a15a82dcfccc9fb32e69970e7f84feed3adbfd
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-10-02 10:57:45 +02:00
parent 565b507554
commit 80caa6cd62

View File

@@ -70,39 +70,6 @@ public:
}); });
} }
void setupValgrindProcess(Process *process, const CommandLine &command) const {
CommandLine cmd = command;
cmd.addArgs(m_valgrindCommand.arguments(), CommandLine::Raw);
// consider appending our options last so they override any interfering user-supplied
// options -q as suggested by valgrind manual
if (cmd.executable().osType() == OsTypeMac) {
// May be slower to start but without it we get no filenames for symbols.
cmd.addArg("--dsymutil=yes");
}
cmd.addCommandLineAsArgs(m_debuggee.command);
emit q->appendMessage(cmd.toUserOutput(), NormalMessageFormat);
process->setCommand(cmd);
process->setWorkingDirectory(m_debuggee.workingDirectory);
process->setEnvironment(m_debuggee.environment);
process->setProcessChannelMode(m_channelMode);
process->setTerminalMode(m_useTerminal ? TerminalMode::Run : TerminalMode::Off);
connect(process, &Process::started, this, [this, process] {
emit q->valgrindStarted(process->processId());
});
connect(process, &Process::readyReadStandardOutput, this, [this, process] {
emit q->appendMessage(process->readAllStandardOutput(), StdOutFormat);
});
connect(process, &Process::readyReadStandardError, this, [this, process] {
emit q->appendMessage(process->readAllStandardError(), StdErrFormat);
});
}
Group runRecipe() const; Group runRecipe() const;
bool run(); bool run();
@@ -177,7 +144,37 @@ Group ValgrindProcessPrivate::runRecipe() const
}; };
const auto onProcessSetup = [this, storage](Process &process) { const auto onProcessSetup = [this, storage](Process &process) {
setupValgrindProcess(&process, storage->m_valgrindCommand); CommandLine cmd = storage->m_valgrindCommand;
cmd.addArgs(m_valgrindCommand.arguments(), CommandLine::Raw);
// consider appending our options last so they override any interfering user-supplied
// options -q as suggested by valgrind manual
if (cmd.executable().osType() == OsTypeMac) {
// May be slower to start but without it we get no filenames for symbols.
cmd.addArg("--dsymutil=yes");
}
cmd.addCommandLineAsArgs(m_debuggee.command);
emit q->appendMessage(cmd.toUserOutput(), NormalMessageFormat);
process.setCommand(cmd);
process.setWorkingDirectory(m_debuggee.workingDirectory);
process.setEnvironment(m_debuggee.environment);
process.setProcessChannelMode(m_channelMode);
process.setTerminalMode(m_useTerminal ? TerminalMode::Run : TerminalMode::Off);
Process *processPtr = &process;
connect(processPtr, &Process::started, this, [this, processPtr] {
emit q->valgrindStarted(processPtr->processId());
});
connect(processPtr, &Process::readyReadStandardOutput, this, [this, processPtr] {
emit q->appendMessage(processPtr->readAllStandardOutput(), StdOutFormat);
});
connect(processPtr, &Process::readyReadStandardError, this, [this, processPtr] {
emit q->appendMessage(processPtr->readAllStandardError(), StdErrFormat);
});
}; };
const auto onProcessDone = [this, storage](const Process &process) { const auto onProcessDone = [this, storage](const Process &process) {
emit q->processErrorReceived(process.errorString(), process.error()); emit q->processErrorReceived(process.errorString(), process.error());