[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)
Adrian Vogelsgesang via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 6 13:33:29 PST 2025
================
@@ -240,6 +240,137 @@ using Message = std::variant<Request, Response, Event>;
bool fromJSON(const llvm::json::Value &, Message &, llvm::json::Path);
llvm::json::Value toJSON(const Message &);
+// MARK: Types
+
+// "Source": {
+// "type": "object",
+// "description": "A `Source` is a descriptor for source code.\nIt is returned
+// from the debug adapter as part of a `StackFrame` and it is used by clients
+// when specifying breakpoints.", "properties": {
+// "name": {
+// "type": "string",
+// "description": "The short name of the source. Every source returned
+// from the debug adapter has a name.\nWhen sending a source to the debug
+// adapter this name is optional."
+// },
+// "path": {
+// "type": "string",
+// "description": "The path of the source to be shown in the UI.\nIt is
+// only used to locate and load the content of the source if no
+// `sourceReference` is specified (or its value is 0)."
+// },
+// "sourceReference": {
+// "type": "integer",
+// "description": "If the value > 0 the contents of the source must be
+// retrieved through the `source` request (even if a path is
+// specified).\nSince a `sourceReference` is only valid for a session, it
+// can not be used to persist a source.\nThe value should be less than or
+// equal to 2147483647 (2^31-1)."
+// },
+// "presentationHint": {
+// "type": "string",
+// "description": "A hint for how to present the source in the UI.\nA
+// value of `deemphasize` can be used to indicate that the source is not
+// available or that it is skipped on stepping.", "enum": [ "normal",
+// "emphasize", "deemphasize" ]
+// },
+// "origin": {
+// "type": "string",
+// "description": "The origin of this source. For example, 'internal
+// module', 'inlined content from source map', etc."
+// },
+// "sources": {
+// "type": "array",
+// "items": {
+// "$ref": "#/definitions/Source"
+// },
+// "description": "A list of sources that are related to this source.
+// These may be the source that generated this source."
+// },
+// "adapterData": {
+// "type": [ "array", "boolean", "integer", "null", "number", "object",
+// "string" ], "description": "Additional data that a debug adapter might
+// want to loop through the client.\nThe client should leave the data
+// intact and persist it across sessions. The client should not interpret
+// the data."
+// },
+// "checksums": {
+// "type": "array",
+// "items": {
+// "$ref": "#/definitions/Checksum"
+// },
+// "description": "The checksums associated with this file."
+// }
+// }
+// },
+struct Source {
+ enum class PresentationHint { normal, emphasize, deemphasize };
+
+ std::optional<std::string> name;
+ std::optional<std::string> path;
+ std::optional<int64_t> sourceReference;
+ std::optional<PresentationHint> presentationHint;
+
+ // unsupproted keys origin, sources, adapterData, checksums
+};
+bool fromJSON(const llvm::json::Value &, Source &, llvm::json::Path);
+llvm::json::Value toJSON(const Source &);
----------------
vogelsgesang wrote:
do we actually need `toJSON`? `fromJSON` should be sufficient for `Source`?
>From what I see, you didn't even implement `toJSON` for `Source`, so this is an unused declaration
```suggestion
```
https://github.com/llvm/llvm-project/pull/130090
More information about the lldb-commits
mailing list