llvm-project
47a969ef - [lldb-dap] Refactor variablesReference storage and scope management. (#179262)

Commit
18 hours ago
[lldb-dap] Refactor variablesReference storage and scope management. (#179262) This commit refactors the Variables class into a VariableReferenceStorage with variableReferences of different ReferenceKinds. The variablesReference is now a uint32_t. The most significant byte (bits 24 - 31) holds the reference kind and the remaining 3 bytes (bits 0 -23) holds the actual reference. We have (at the moment) 3 reference kinds. Temporary => 0b0000 => 0x00 Permanent => 0b0001 => 0x01 Scope => 0b0010 => 0x03 The actual variablesReference can be used to get a `VariableStore`. VariableStore holds variables in a group. It has two implementations: - ScopeStore: Holds variables within frame scopes (locals, globals, registers). This is lazy-loaded and only fetched when variable(s) in the scope is requested. - ExpandableValueStore: Holds SBValue and fetches it's variable children when requested. ReferenceKindPool: The variablesReference created starts from 1 with the mask of the Reference kind applied. It holds vector of VariableStore of one Referencekind, This allows constant lookup of a reference Example: ```md | maskedVariablesReference | Mask | variablesReference | RefrenceKind | VariableStore | |--------------------------|------|--------------------|--------------|---------------| | 20 -> 0x00000014 | 0x00 | 20 -> 0x00000014 | temporary | ValueStore | | 268435476 -> 0x01000014 | 0x01 | 20 -> 0x00000014 | permanent | ValueStore | | 536870932 -> 0x01000014 | 0x02 | 20 -> 0x00000014 | scope | ScopeStore | ```
Author
Parents
Loading