================ @@ -103,3 +120,76 @@ lldb::SBValue Variables::FindVariable(uint64_t variablesReference, } return variable; } + +std::optional<ScopeData> +Variables::GetScopeKind(const int64_t variablesReference) { + auto scope_kind_iter = m_scope_kinds.find(variablesReference); + if (scope_kind_iter == m_scope_kinds.end()) { + return std::nullopt; + } + + auto scope_iter = m_frames.find(scope_kind_iter->second.second); + if (scope_iter == m_frames.end()) { + return std::nullopt; + } + + switch (scope_kind_iter->second.first) { + case lldb_dap::ScopeKind::Locals: + return ScopeData(scope_kind_iter->second.first, + std::get<0>(scope_iter->second)); + case lldb_dap::ScopeKind::Globals: + return ScopeData(scope_kind_iter->second.first, + std::get<1>(scope_iter->second)); + case lldb_dap::ScopeKind::Registers: + return ScopeData(scope_kind_iter->second.first, + std::get<2>(scope_iter->second)); + } + + return std::nullopt; +} + +lldb::SBValueList *Variables::GetScope(const uint32_t frame_id, + const ScopeKind kind) { + + auto frame = m_frames.find(frame_id); + if (m_frames.find(frame_id) == m_frames.end()) { + return nullptr; + } + + switch (kind) { + case ScopeKind::Locals: + return &std::get<0>(frame->second); + case ScopeKind::Globals: + return &std::get<1>(frame->second); + case ScopeKind::Registers: + return &std::get<2>(frame->second); + } + + return nullptr; +} + +void Variables::ReadyFrame(uint32_t frame_id, lldb::SBFrame &frame) { ---------------- Anthony-Eid wrote:
Done https://github.com/llvm/llvm-project/pull/124232 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits