aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-06-20 10:48:04 -0500
committerGitHub <noreply@github.com>2025-06-20 10:48:04 -0500
commit9524bfb27020d31b9474f595b7c0e5d2e1ac65f5 (patch)
tree17cd2d0f3751fb9cf4a3bf6718715425586f5216 /lldb/source/Interpreter/CommandInterpreter.cpp
parent887222e3526fbe08e748a33f740296ac22bf1ab1 (diff)
downloadllvm-9524bfb27020d31b9474f595b7c0e5d2e1ac65f5.zip
llvm-9524bfb27020d31b9474f595b7c0e5d2e1ac65f5.tar.gz
llvm-9524bfb27020d31b9474f595b7c0e5d2e1ac65f5.tar.bz2
[lldb] Add Model Context Protocol (MCP) support to LLDB (#143628)
This PR adds an MCP (Model Context Protocol ) server to LLDB. For motivation and background, please refer to the corresponding RFC: https://discourse.llvm.org/t/rfc-adding-mcp-support-to-lldb/86798 I implemented this as a new kind of plugin. The idea is that we could support multiple protocol servers (e.g. if we want to support DAP from within LLDB). This also introduces a corresponding top-level command (`protocol-server`) with two subcommands to `start` and `stop` the server. ``` (lldb) protocol-server start MCP tcp://localhost:1234 MCP server started with connection listeners: connection://[::1]:1234, connection://[127.0.0.1]:1234 ``` The MCP sever supports one tool (`lldb_command`) which executes a command, but can easily be extended with more commands.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 4f9ae10..00c3472 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -30,6 +30,7 @@
#include "Commands/CommandObjectPlatform.h"
#include "Commands/CommandObjectPlugin.h"
#include "Commands/CommandObjectProcess.h"
+#include "Commands/CommandObjectProtocolServer.h"
#include "Commands/CommandObjectQuit.h"
#include "Commands/CommandObjectRegexCommand.h"
#include "Commands/CommandObjectRegister.h"
@@ -574,6 +575,7 @@ void CommandInterpreter::LoadCommandDictionary() {
REGISTER_COMMAND_OBJECT("platform", CommandObjectPlatform);
REGISTER_COMMAND_OBJECT("plugin", CommandObjectPlugin);
REGISTER_COMMAND_OBJECT("process", CommandObjectMultiwordProcess);
+ REGISTER_COMMAND_OBJECT("protocol-server", CommandObjectProtocolServer);
REGISTER_COMMAND_OBJECT("quit", CommandObjectQuit);
REGISTER_COMMAND_OBJECT("register", CommandObjectRegister);
REGISTER_COMMAND_OBJECT("scripting", CommandObjectMultiwordScripting);