Commit d34f33d8 authored by hjk's avatar hjk

Valgrind: Extend and use new DebuggerRunTool interface

Change-Id: I5e015a484e67175be12d538e7f814d61001ad7bb
Reviewed-by: default avatarhjk <hjk@qt.io>
parent ce62181c
......@@ -193,6 +193,16 @@ void DebuggerRunTool::setCloseMode(DebuggerCloseMode closeMode)
m_runParameters.closeMode = closeMode;
}
void DebuggerRunTool::setAttachPid(ProcessHandle pid)
{
m_runParameters.attachPID = pid;
}
void DebuggerRunTool::setSysRoot(const QString &sysRoot)
{
m_runParameters.sysRoot = sysRoot;
}
void DebuggerRunTool::setSymbolFile(const QString &symbolFile)
{
if (symbolFile.isEmpty())
......@@ -210,6 +220,21 @@ void DebuggerRunTool::setUseExtendedRemote(bool on)
m_runParameters.useExtendedRemote = on;
}
void DebuggerRunTool::setUseContinueInsteadOfRun(bool on)
{
m_runParameters.useContinueInsteadOfRun = on;
}
void DebuggerRunTool::setUseTargetAsync(bool on)
{
m_runParameters.useTargetAsync = on;
}
void DebuggerRunTool::setSkipExecutableValidation(bool on)
{
m_runParameters.skipExecutableValidation = on;
}
void DebuggerRunTool::setQmlServer(const QUrl &qmlServer)
{
m_runParameters.qmlServer = qmlServer;
......@@ -247,6 +272,16 @@ void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
}
}
void DebuggerRunTool::addExpectedSignal(const QString &signal)
{
m_runParameters.expectedSignals.append(signal);
}
void DebuggerRunTool::addSearchDirectory(const QString &dir)
{
m_runParameters.additionalSearchDirectories.append(dir);
}
static QLatin1String engineTypeName(DebuggerEngineType et)
{
switch (et) {
......@@ -355,6 +390,11 @@ int DebuggerRunTool::portsUsedByDebugger() const
return isCppDebugging() + isQmlDebugging();
}
void DebuggerRunTool::setSolibSearchPath(const QStringList &list)
{
m_runParameters.solibSearchPath = list;
}
void DebuggerRunTool::notifyInferiorIll()
{
m_engine->notifyInferiorIll();
......@@ -729,7 +769,7 @@ DebuggerEngine *DebuggerRunTool::activeEngine() const
return m_engine ? m_engine->activeEngine() : nullptr;
}
void DebuggerRunTool::appendSolibSearchPath(const QString &str)
void DebuggerRunTool::addSolibSearchDir(const QString &str)
{
QString path = str;
path.replace("%{sysroot}", m_runParameters.sysRoot);
......
......@@ -77,7 +77,8 @@ public:
bool isQmlDebugging() const { return m_isQmlDebugging; }
int portsUsedByDebugger() const;
void appendSolibSearchPath(const QString &str);
void setSolibSearchPath(const QStringList &list);
void addSolibSearchDir(const QString &str);
static void setBreakOnMainNextTime();
......@@ -86,13 +87,22 @@ public:
void prependInferiorCommandLineArgument(const QString &arg);
void addQmlServerInferiorCommandLineArgumentIfNeeded();
void addExpectedSignal(const QString &signal);
void addSearchDirectory(const QString &dir);
void setStartMode(DebuggerStartMode startMode);
void setCloseMode(DebuggerCloseMode closeMode);
void setAttachPid(Utils::ProcessHandle pid);
void setSysRoot(const QString &sysRoot);
void setSymbolFile(const QString &symbolFile);
void setGdbServerChannel(const QString &channel);
void setUseExtendedRemote(bool on);
void setUseContinueInsteadOfRun(bool on);
void setUseTargetAsync(bool on);
void setSkipExecutableValidation(bool on);
void setQmlServer(const QUrl &qmlServer);
signals:
......
......@@ -163,18 +163,16 @@ QStringList MemcheckToolRunner::suppressionFiles() const
void MemcheckToolRunner::startDebugger(qint64 valgrindPid)
{
Debugger::DebuggerStartParameters sp;
sp.inferior = runnable().as<StandardRunnable>();
sp.startMode = Debugger::AttachToRemoteServer;
sp.displayName = QString("VGdb %1").arg(valgrindPid);
sp.remoteChannel = QString("| vgdb --pid=%1").arg(valgrindPid);
sp.useContinueInsteadOfRun = true;
sp.expectedSignals.append("SIGTRAP");
auto gdbWorker = new Debugger::DebuggerRunTool(runControl());
gdbWorker->setStartParameters(sp);
gdbWorker->initiateStart();
connect(runControl(), &RunControl::stopped, gdbWorker, &RunControl::deleteLater);
auto debugger = new Debugger::DebuggerRunTool(runControl());
debugger->setStartMode(Debugger::AttachToRemoteServer);
debugger->setRunControlName(QString("VGdb %1").arg(valgrindPid));
debugger->setGdbServerChannel(QString("| vgdb --pid=%1").arg(valgrindPid));
debugger->setUseContinueInsteadOfRun(true);
debugger->addExpectedSignal("SIGTRAP");
connect(runControl(), &RunControl::stopped, debugger, &RunControl::deleteLater);
debugger->initiateStart();
}
void MemcheckToolRunner::appendLog(const QByteArray &data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment