[Lldb-commits] [lldb] [lldb][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Thu May 8 16:07:56 PDT 2025
================
@@ -302,6 +302,74 @@ struct Source {
// unsupported keys: origin, sources, adapterData, checksums
};
bool fromJSON(const llvm::json::Value &, Source &, llvm::json::Path);
+llvm::json::Value toJSON(const Source &);
+
+/// A `Scope` is a named container for variables. Optionally a scope can map to
+/// a source or a range within a source.
+struct Scope {
+ enum PresentationHint : unsigned {
+ ePresentationHintArguments,
+ ePresentationHintLocals,
+ ePresentationHintRegisters,
+ ePresentationHintReturnValue
+ };
+ /// Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This
+ /// string is shown in the UI as is and can be translated.
+ ////
+ std::string name;
+
+ /// A hint for how to present this scope in the UI. If this attribute is
+ /// missing, the scope is shown with a generic UI.
+ /// Values:
+ /// 'arguments': Scope contains method arguments.
+ /// 'locals': Scope contains local variables.
+ /// 'registers': Scope contains registers. Only a single `registers` scope
+ /// should be returned from a `scopes` request.
+ /// 'returnValue': Scope contains one or more return values.
+ /// etc.
+ std::optional<PresentationHint> presentationHint;
+
+ /// The variables of this scope can be retrieved by passing the value of
+ /// `variablesReference` to the `variables` request as long as execution
+ /// remains suspended. See 'Lifetime of Object References' in the Overview
+ /// section for details.
+ ////
+ uint64_t variablesReference;
----------------
ashgti wrote:
Can we also have a default value for this one as well? Maybe:
```
#define LLDB_DAP_INVALID_VARIABLE_REF UINT64_MAX
```
https://github.com/llvm/llvm-project/pull/138116
More information about the lldb-commits
mailing list