llvm-project/lldb/source/Core/CMakeLists.txt
Jonas Devlieghere 9524bfb270
[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.
2025-06-20 10:48:04 -05:00

99 lines
2.1 KiB
CMake

lldb_tablegen(CoreProperties.inc -gen-lldb-property-defs
SOURCE CoreProperties.td
TARGET LLDBCorePropertiesGen)
lldb_tablegen(CorePropertiesEnum.inc -gen-lldb-property-enum-defs
SOURCE CoreProperties.td
TARGET LLDBCorePropertiesEnumGen)
set(LLDB_CURSES_LIBS)
set(LLDB_LIBEDIT_LIBS)
if (LLDB_ENABLE_CURSES)
list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_CURSES_LIBS gpm)
endif()
endif()
add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES
Address.cpp
AddressRange.cpp
AddressRangeListImpl.cpp
AddressResolver.cpp
AddressResolverFileLine.cpp
Communication.cpp
DataFileCache.cpp
Debugger.cpp
DebuggerEvents.cpp
Declaration.cpp
DemangledNameInfo.cpp
Disassembler.cpp
DumpDataExtractor.cpp
DumpRegisterValue.cpp
DumpRegisterInfo.cpp
DynamicLoader.cpp
EmulateInstruction.cpp
FileLineResolver.cpp
FormatEntity.cpp
Highlighter.cpp
IOHandler.cpp
IOHandlerCursesGUI.cpp
Mangled.cpp
Module.cpp
ModuleChild.cpp
ModuleList.cpp
Opcode.cpp
PluginManager.cpp
Progress.cpp
ProtocolServer.cpp
Statusline.cpp
RichManglingContext.cpp
SearchFilter.cpp
Section.cpp
SourceLocationSpec.cpp
SourceManager.cpp
StreamAsynchronousIO.cpp
Telemetry.cpp
ThreadedCommunication.cpp
UserSettingsController.cpp
Value.cpp
ADDITIONAL_HEADER_DIRS
${LLDB_INCLUDE_DIR}/lldb/Core
DEPENDS
clang-tablegen-targets
LINK_COMPONENTS
Support
Demangle
TargetParser
Telemetry
LINK_LIBS
lldbBreakpoint
lldbDataFormatters
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbValueObject
lldbVersion
${LLDB_CURSES_LIBS}
CLANG_LIBS
clangDriver
)
add_dependencies(lldbCore
LLDBCorePropertiesGen
LLDBCorePropertiesEnumGen)
# Needed to properly resolve references in a debug build.
# TODO: Remove once we have better layering
set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
if (LLDB_ENABLE_CURSES)
target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS})
endif()