================ @@ -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 &); + +// MARK: Requests + +// "SourceArguments": { +// "type": "object", +// "description": "Arguments for `source` request.", +// "properties": { +// "source": { +// "$ref": "#/definitions/Source", +// "description": "Specifies the source content to load. Either +// `source.path` or `source.sourceReference` must be specified." +// }, +// "sourceReference": { +// "type": "integer", +// "description": "The reference to the source. This is the same as +// `source.sourceReference`.\nThis is provided for backward compatibility +// since old clients do not understand the `source` attribute." +// } +// }, +// "required": [ "sourceReference" ] +// }, +struct SourceArguments { ---------------- vogelsgesang wrote:
> I'm fine with changing how we structure things, but I liked having the > distinction between lldb_dap::protocol for the underlying protocol, lldb_dap > for our intermediate components and lldb/lldb_private for the SB API layer of > the debugger itself. Indeed, you brought up a couple of good arguments for keeping the protocol separate. I am undecided. Let's see if anyone else jumps in and also has additional arguments in either direction. Otherwise, I would be fine with either way. > The [DAP > spec](https://microsoft.github.io/debug-adapter-protocol/specification) > already groups at a high level into Base Protocol, Events, Requests, Reverse > Requests and Types, which I was roughly following in this file using // MARK: > <category> headings between sections. Even if we don't move `*Args`, `*Request` and `*Response` types to the corresponding `*RequestHandler`, I think we should still separate the base protocol from the remaining protocol types. I would prefer separate files over `// MARK: <category>` comments for that purpose, i.e. a `Protocol.{h,cpp}` (containing the events, request and response types) and a separate `BaseProtocol.{h,cpp}` (containing the base protocol) https://github.com/llvm/llvm-project/pull/130090 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits