[Lldb-commits] [lldb] lldb-dap: Stop using replicated variable ids (PR #124232)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 29 08:53:02 PDT 2025
================
@@ -103,3 +119,55 @@ lldb::SBValue Variables::FindVariable(uint64_t variablesReference,
}
return variable;
}
+
+std::optional<ScopeKind>
+Variables::GetScopeKind(const int64_t variablesReference) {
+ auto iter = m_scope_kinds.find(variablesReference);
+ if (iter != m_scope_kinds.end()) {
+ return iter->second.first;
+ }
+
+ return std::nullopt;
+}
+
+bool Variables::SwitchFrame(const uint32_t frame_id) {
+ auto iter = m_frames.find(frame_id);
+
+ if (iter == m_frames.end()) {
+ return false;
+ }
+
+ auto [frame_locals, frame_globals, frame_registers] = iter->second;
+
+ locals = frame_locals;
+ globals = frame_globals;
+ registers = frame_registers;
+
+ return true;
+}
+
+void Variables::ReadyFrame(uint32_t frame_id, lldb::SBFrame &frame) {
+ if (m_frames.find(frame_id) == m_frames.end()) {
+
+ auto locals = frame.GetVariables(/*arguments=*/true,
+ /*locals=*/true,
+ /*statics=*/false,
+ /*in_scope_only=*/true);
+
+ auto globals = frame.GetVariables(/*arguments=*/false,
+ /*locals=*/false,
+ /*statics=*/true,
+ /*in_scope_only=*/true);
+
+ auto registers = frame.GetRegisters();
+
+ m_frames.insert(
+ std::make_pair(frame_id, std::make_tuple(locals, globals, registers)));
+ }
+}
----------------
ashgti wrote:
A `SBValueList` is the container for the variables, like the local or global or registers.
> Would doing something like this work (under m_frames.insert())?
Yea
https://github.com/llvm/llvm-project/pull/124232
More information about the lldb-commits
mailing list