forked from qt-creator/qt-creator
ValgrindRunner: Store the input data outside of the process
Apply it when process is started. This is a preparation step before employing the task tree inside the ValgrindRunner. Change-Id: I4cb64ef72b353af7ca97ae61fded23d9cea5e365 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -57,17 +57,18 @@ public:
|
|||||||
bool startServers();
|
bool startServers();
|
||||||
bool run();
|
bool run();
|
||||||
|
|
||||||
ValgrindRunner *q;
|
ValgrindRunner *q = nullptr;
|
||||||
|
|
||||||
|
CommandLine m_valgrindCommand;
|
||||||
Runnable m_debuggee;
|
Runnable m_debuggee;
|
||||||
|
QProcess::ProcessChannelMode m_channelMode = QProcess::SeparateChannels;
|
||||||
CommandLine m_command;
|
|
||||||
Process m_process;
|
|
||||||
|
|
||||||
QHostAddress m_localServerAddress;
|
QHostAddress m_localServerAddress;
|
||||||
|
bool m_useTerminal = false;
|
||||||
|
|
||||||
|
Process m_process;
|
||||||
QTcpServer m_xmlServer;
|
QTcpServer m_xmlServer;
|
||||||
Parser m_parser;
|
|
||||||
QTcpServer m_logServer;
|
QTcpServer m_logServer;
|
||||||
|
Parser m_parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ValgrindRunner::Private::xmlSocketConnected()
|
void ValgrindRunner::Private::xmlSocketConnected()
|
||||||
@@ -112,7 +113,7 @@ bool ValgrindRunner::Private::startServers()
|
|||||||
bool ValgrindRunner::Private::run()
|
bool ValgrindRunner::Private::run()
|
||||||
{
|
{
|
||||||
CommandLine cmd;
|
CommandLine cmd;
|
||||||
cmd.setExecutable(m_command.executable());
|
cmd.setExecutable(m_valgrindCommand.executable());
|
||||||
|
|
||||||
if (!m_localServerAddress.isNull()) {
|
if (!m_localServerAddress.isNull()) {
|
||||||
if (!startServers())
|
if (!startServers())
|
||||||
@@ -144,7 +145,7 @@ bool ValgrindRunner::Private::run()
|
|||||||
if (enableXml)
|
if (enableXml)
|
||||||
cmd.addArg("--xml=yes");
|
cmd.addArg("--xml=yes");
|
||||||
}
|
}
|
||||||
cmd.addArgs(m_command.arguments(), CommandLine::Raw);
|
cmd.addArgs(m_valgrindCommand.arguments(), CommandLine::Raw);
|
||||||
|
|
||||||
// consider appending our options last so they override any interfering user-supplied options
|
// consider appending our options last so they override any interfering user-supplied options
|
||||||
// -q as suggested by valgrind manual
|
// -q as suggested by valgrind manual
|
||||||
@@ -161,6 +162,8 @@ bool ValgrindRunner::Private::run()
|
|||||||
m_process.setCommand(cmd);
|
m_process.setCommand(cmd);
|
||||||
m_process.setWorkingDirectory(m_debuggee.workingDirectory);
|
m_process.setWorkingDirectory(m_debuggee.workingDirectory);
|
||||||
m_process.setEnvironment(m_debuggee.environment);
|
m_process.setEnvironment(m_debuggee.environment);
|
||||||
|
m_process.setProcessChannelMode(m_channelMode);
|
||||||
|
m_process.setTerminalMode(m_useTerminal ? TerminalMode::Run : TerminalMode::Off);
|
||||||
m_process.start();
|
m_process.start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -186,7 +189,7 @@ ValgrindRunner::~ValgrindRunner()
|
|||||||
|
|
||||||
void ValgrindRunner::setValgrindCommand(const CommandLine &command)
|
void ValgrindRunner::setValgrindCommand(const CommandLine &command)
|
||||||
{
|
{
|
||||||
d->m_command = command;
|
d->m_valgrindCommand = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindRunner::setDebuggee(const Runnable &debuggee)
|
void ValgrindRunner::setDebuggee(const Runnable &debuggee)
|
||||||
@@ -196,7 +199,7 @@ void ValgrindRunner::setDebuggee(const Runnable &debuggee)
|
|||||||
|
|
||||||
void ValgrindRunner::setProcessChannelMode(QProcess::ProcessChannelMode mode)
|
void ValgrindRunner::setProcessChannelMode(QProcess::ProcessChannelMode mode)
|
||||||
{
|
{
|
||||||
d->m_process.setProcessChannelMode(mode);
|
d->m_channelMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindRunner::setLocalServerAddress(const QHostAddress &localServerAddress)
|
void ValgrindRunner::setLocalServerAddress(const QHostAddress &localServerAddress)
|
||||||
@@ -206,7 +209,7 @@ void ValgrindRunner::setLocalServerAddress(const QHostAddress &localServerAddres
|
|||||||
|
|
||||||
void ValgrindRunner::setUseTerminal(bool on)
|
void ValgrindRunner::setUseTerminal(bool on)
|
||||||
{
|
{
|
||||||
d->m_process.setTerminalMode(on ? TerminalMode::Run : TerminalMode::Off);
|
d->m_useTerminal = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindRunner::waitForFinished() const
|
void ValgrindRunner::waitForFinished() const
|
||||||
|
Reference in New Issue
Block a user