summaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/JSONTransport.cpp
AgeCommit message (Collapse)Author
2025-10-03[lldb] Adding A new Binding helper for JSONTransport. (#159160)John Harrison
This adds a new Binding helper class to allow mapping of incoming and outgoing requests / events to specific handlers. This should make it easier to create new protocol implementations and allow us to create a relay in the lldb-mcp binary.
2025-08-19[lldb] Refactoring JSONTransport into an abstract RPC Message Handler and ↵John Harrison
transport layer. (#153121) This abstracts the base Transport handler to have a MessageHandler component and allows us to generalize both JSON-RPC 2.0 for MCP (or an LSP) and DAP format. This should allow us to create clearly defined clients and servers for protocols, both for testing and for RPC between the lldb instances and an lldb-mcp multiplexer. This basic model is inspiried by the clangd/Transport.h file and the mlir/lsp-server-support/Transport.h that are both used for LSP servers within the llvm project. Additionally, this helps with testing by subclassing `Transport` to allow us to simplify sending/receiving messages without needing to use a toJSON/fromJSON and a pair of pipes, see `TestTransport` in DAP/TestBase.h.
2025-08-11[lldb] Update JSONTransport to use MainLoop for reading. (#152367)John Harrison
Reapply "[lldb] Update JSONTransport to use MainLoop for reading." (#152155) This reverts commit cd40281685f642ad879e33f3fda8d1faa136ebf4. This also includes some updates to try to address the platforms with failing tests. I updated the JSONTransport and tests to use std::function instead of llvm:unique_function. I think the tests were failing due to the unique_function not being moved correctly in the loop on some platforms.
2025-08-05Revert "[lldb] Update JSONTransport to use MainLoop for reading." (#152155)John Harrison
Reverts llvm/llvm-project#148300 This is crashing in the aarch64 linux CI job. I'll revert it while I investigate why this is crashing.
2025-08-05[lldb] Update JSONTransport to use MainLoop for reading. (#148300)John Harrison
This updates JSONTransport to use a MainLoop for reading messages. This also allows us to read in larger chunks than we did previously. With the event driven reading operations we can read in chunks and store the contents in an internal buffer. Separately we can parse the buffer and split the contents up into messages. Our previous version approach would read a byte at a time, which is less efficient.
2025-07-02[lldb] Fixing warnings / win32 builds in MainLoop. (#146632)John Harrison
Commit 1a7b7e24bcc1041ae0fb90abcfb73d36d76f4a07 introduced a few casting warnings and a build issue in Win32 platforms. Trying to correct the casts to c++ style casts instead of C style casts.
2025-07-01[lldb] Adding pipe support to lldb_private::MainLoopWindows. (#145621)John Harrison
This updates MainLoopWindows to support events for reading from a pipe (both anonymous and named pipes) as well as sockets. This unifies both handle types using `WSAWaitForMultipleEvents` which can listen to both sockets and handles for change events. This should allow us to unify how we handle watching pipes/sockets on Windows and Posix systems. We can extend this in the future if we want to support watching other types, like files or even other events like a process life time. --------- Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-06-12[lldb] Implement JSON RPC (newline delimited) Transport (#143946)Jonas Devlieghere
This PR implements JSON RPC-style (i.e. newline delimited) JSON transport. I moved the existing transport tests from DAP to Host and moved the PipeTest base class into TestingSupport so it can be shared by both.
2025-06-11[lldb] Move Transport class into lldb_private (NFC) (#143806)Jonas Devlieghere
Move lldb-dap's Transport class into lldb_private so the code can be shared between the "JSON with header" protocol used by DAP and the JSON RPC protocol used by MCP (see [1]). [1]: https://discourse.llvm.org/t/rfc-adding-mcp-support-to-lldb/86798