forked from qt-creator/qt-creator
DAP: Add proper stack frame selection
- Fixed locals view freezing when scope is empty Change-Id: I1e64217b061937ab66abf3508e2156e9a2c1460c Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -218,7 +218,9 @@ void DapEngine::activateFrame(int frameIndex)
|
||||
QTC_ASSERT(frameIndex < handler->stackSize(), return);
|
||||
handler->setCurrentIndex(frameIndex);
|
||||
gotoLocation(handler->currentFrame());
|
||||
updateLocals();
|
||||
|
||||
m_currentStackFrameId = handler->currentFrame().debuggerId;
|
||||
m_dapClient->scopes(m_currentStackFrameId);
|
||||
}
|
||||
|
||||
void DapEngine::selectThread(const Thread &thread)
|
||||
@@ -546,7 +548,8 @@ void DapEngine::handleStackTraceResponse(const QJsonObject &response)
|
||||
gotoLocation(Location(file, line));
|
||||
|
||||
refreshStack(stackFrames);
|
||||
m_dapClient->scopes(stackFrame.value("id").toInt());
|
||||
m_currentStackFrameId = stackFrame.value("id").toInt();
|
||||
m_dapClient->scopes(m_currentStackFrameId);
|
||||
}
|
||||
|
||||
void DapEngine::handleScopesResponse(const QJsonObject &response)
|
||||
@@ -568,9 +571,13 @@ void DapEngine::handleScopesResponse(const QJsonObject &response)
|
||||
m_variablesReferenceQueue.push(scope.toObject().value("variablesReference").toInt());
|
||||
}
|
||||
|
||||
m_isFirstLayer = true;
|
||||
m_dapClient->variables(m_variablesReferenceQueue.front());
|
||||
m_variablesReferenceQueue.pop();
|
||||
if (!m_variablesReferenceQueue.empty()) {
|
||||
m_isFirstLayer = true;
|
||||
m_dapClient->variables(m_variablesReferenceQueue.front());
|
||||
m_variablesReferenceQueue.pop();
|
||||
} else {
|
||||
watchHandler()->notifyUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void DapEngine::handleThreadsResponse(const QJsonObject &response)
|
||||
@@ -761,6 +768,7 @@ void DapEngine::refreshStack(const QJsonArray &stackFrames)
|
||||
frame.file = FilePath::fromString(source.value("path").toString());
|
||||
frame.address = item.value("instructionPointerReference").toInt();
|
||||
frame.usable = frame.file.isReadableFile();
|
||||
frame.debuggerId = item.value("id").toInt();
|
||||
frames.append(frame);
|
||||
}
|
||||
handler->setFrames(frames, false);
|
||||
|
||||
@@ -114,6 +114,7 @@ protected:
|
||||
|
||||
int m_nextBreakpointId = 1;
|
||||
int m_currentThreadId = -1;
|
||||
int m_currentStackFrameId = -1;
|
||||
|
||||
bool m_isFirstLayer = true;
|
||||
std::queue<int> m_variablesReferenceQueue;
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
quint64 address = 0;
|
||||
bool usable = false;
|
||||
QString context; // Opaque value produced and consumed by the native backends.
|
||||
uint debuggerId = 0;
|
||||
};
|
||||
|
||||
using StackFrames = QList<StackFrame>;
|
||||
|
||||
Reference in New Issue
Block a user