LldbEngine: Connect to done() signal

Instead of connecting to errorOccurred() and finished() signals.

Change-Id: If82a7c79bba9bd3457d07fbc212f6b007699b0f0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-06-17 12:59:27 +02:00
parent d4b8739653
commit 91d1ed25c2
2 changed files with 14 additions and 29 deletions

View File

@@ -92,21 +92,14 @@ LldbEngine::LldbEngine()
setDebuggerName("LLDB"); setDebuggerName("LLDB");
DebuggerSettings &ds = *debuggerSettings(); DebuggerSettings &ds = *debuggerSettings();
connect(&ds.autoDerefPointers, &BaseAspect::changed, connect(&ds.autoDerefPointers, &BaseAspect::changed, this, &LldbEngine::updateLocals);
this, &LldbEngine::updateLocals);
connect(ds.createFullBacktrace.action(), &QAction::triggered, connect(ds.createFullBacktrace.action(), &QAction::triggered,
this, &LldbEngine::fetchFullBacktrace); this, &LldbEngine::fetchFullBacktrace);
connect(&ds.useDebuggingHelpers, &BaseAspect::changed, connect(&ds.useDebuggingHelpers, &BaseAspect::changed, this, &LldbEngine::updateLocals);
this, &LldbEngine::updateLocals); connect(&ds.useDynamicType, &BaseAspect::changed, this, &LldbEngine::updateLocals);
connect(&ds.useDynamicType, &BaseAspect::changed, connect(&ds.intelFlavor, &BaseAspect::changed, this, &LldbEngine::updateAll);
this, &LldbEngine::updateLocals);
connect(&ds.intelFlavor, &BaseAspect::changed,
this, &LldbEngine::updateAll);
connect(&m_lldbProc, &QtcProcess::errorOccurred, connect(&m_lldbProc, &QtcProcess::done, this, &LldbEngine::handleLldbDone);
this, &LldbEngine::handleLldbError);
connect(&m_lldbProc, &QtcProcess::finished,
this, &LldbEngine::handleLldbFinished);
connect(&m_lldbProc, &QtcProcess::readyReadStandardOutput, connect(&m_lldbProc, &QtcProcess::readyReadStandardOutput,
this, &LldbEngine::readLldbStandardOutput); this, &LldbEngine::readLldbStandardOutput);
connect(&m_lldbProc, &QtcProcess::readyReadStandardError, connect(&m_lldbProc, &QtcProcess::readyReadStandardError,
@@ -116,11 +109,6 @@ LldbEngine::LldbEngine()
this, &LldbEngine::handleResponse, Qt::QueuedConnection); this, &LldbEngine::handleResponse, Qt::QueuedConnection);
} }
LldbEngine::~LldbEngine()
{
m_lldbProc.disconnect();
}
void LldbEngine::executeDebuggerCommand(const QString &command) void LldbEngine::executeDebuggerCommand(const QString &command)
{ {
DebuggerCommand cmd("executeDebuggerCommand"); DebuggerCommand cmd("executeDebuggerCommand");
@@ -782,12 +770,17 @@ void LldbEngine::doUpdateLocals(const UpdateParameters &params)
runCommand(cmd); runCommand(cmd);
} }
void LldbEngine::handleLldbError(QProcess::ProcessError error) void LldbEngine::handleLldbDone()
{ {
if (m_lldbProc.error() == QProcess::UnknownError) {
notifyDebuggerProcessFinished(m_lldbProc.resultData(), "LLDB");
return;
}
const QProcess::ProcessError error = m_lldbProc.error();
showMessage(QString("LLDB PROCESS ERROR: %1").arg(error)); showMessage(QString("LLDB PROCESS ERROR: %1").arg(error));
switch (error) { switch (error) {
case QProcess::Crashed: case QProcess::Crashed:
m_lldbProc.disconnect();
notifyEngineShutdownFinished(); notifyEngineShutdownFinished();
break; // will get a processExited() as well break; // will get a processExited() as well
// impossible case QProcess::FailedToStart: // impossible case QProcess::FailedToStart:
@@ -796,7 +789,6 @@ void LldbEngine::handleLldbError(QProcess::ProcessError error)
case QProcess::Timedout: case QProcess::Timedout:
default: default:
//setState(EngineShutdownRequested, true); //setState(EngineShutdownRequested, true);
m_lldbProc.stop();
AsynchronousMessageBox::critical(tr("LLDB I/O Error"), errorMessage(error)); AsynchronousMessageBox::critical(tr("LLDB I/O Error"), errorMessage(error));
break; break;
} }
@@ -829,11 +821,6 @@ QString LldbEngine::errorMessage(QProcess::ProcessError error) const
} }
} }
void LldbEngine::handleLldbFinished()
{
notifyDebuggerProcessFinished(m_lldbProc.resultData(), "LLDB");
}
void LldbEngine::readLldbStandardError() void LldbEngine::readLldbStandardError()
{ {
QString err = QString::fromUtf8(m_lldbProc.readAllStandardError()); QString err = QString::fromUtf8(m_lldbProc.readAllStandardError());
@@ -921,7 +908,7 @@ void LldbEngine::handleStateNotification(const GdbMi &item)
void LldbEngine::handleLocationNotification(const GdbMi &reportedLocation) void LldbEngine::handleLocationNotification(const GdbMi &reportedLocation)
{ {
qulonglong address = reportedLocation["address"].toAddress(); qulonglong address = reportedLocation["address"].toAddress();
Utils::FilePath fileName = FilePath::fromUserInput(reportedLocation["file"].data()); FilePath fileName = FilePath::fromUserInput(reportedLocation["file"].data());
QString function = reportedLocation["function"].data(); QString function = reportedLocation["function"].data();
int lineNumber = reportedLocation["line"].toInt(); int lineNumber = reportedLocation["line"].toInt();
Location loc = Location(fileName, lineNumber); Location loc = Location(fileName, lineNumber);

View File

@@ -53,7 +53,6 @@ class LldbEngine : public CppDebuggerEngine
public: public:
LldbEngine(); LldbEngine();
~LldbEngine() override;
signals: signals:
void outputReady(const QString &data); void outputReady(const QString &data);
@@ -111,8 +110,7 @@ private:
QString errorMessage(QProcess::ProcessError error) const; QString errorMessage(QProcess::ProcessError error) const;
bool hasCapability(unsigned cap) const override; bool hasCapability(unsigned cap) const override;
void handleLldbFinished(); void handleLldbDone();
void handleLldbError(QProcess::ProcessError error);
void readLldbStandardOutput(); void readLldbStandardOutput();
void readLldbStandardError(); void readLldbStandardError();