[Lldb-commits] [lldb] [lldb] Add LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS option (PR #196110)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed May 6 09:28:36 PDT 2026
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/196110
Add a CMake option that will gate building the script interpreter plugins as separate shared libraries, and expose it to C++ via lldb/Host/Config.h.
The option defaults to OFF and currently has no consumers; subsequent patches wire up the plugin, binding, and test build to use it.
Because dynamic plugins resolve lldb_private symbols against liblldb at runtime, enabling this option implies LLDB_EXPORT_ALL_SYMBOLS. The default for LLDB_EXPORT_ALL_SYMBOLS now follows
LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS, and a FATAL_ERROR is raised if the user explicitly disables symbol export while requesting dynamic plugins.
Extracted from #189718 for easier reviewing.
>From b73f083eeefdb1f11fd75ab7c5981b92a978c1ef Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Wed, 6 May 2026 09:26:56 -0700
Subject: [PATCH] [lldb] Add LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS option
Add a CMake option that will gate building the script interpreter
plugins as separate shared libraries, and expose it to C++ via
lldb/Host/Config.h.
The option defaults to OFF and currently has no consumers; subsequent
patches wire up the plugin, binding, and test build to use it.
Because dynamic plugins resolve lldb_private symbols against liblldb at
runtime, enabling this option implies LLDB_EXPORT_ALL_SYMBOLS. The
default for LLDB_EXPORT_ALL_SYMBOLS now follows
LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS, and a FATAL_ERROR is raised if
the user explicitly disables symbol export while requesting dynamic
plugins.
---
lldb/cmake/modules/LLDBConfig.cmake | 7 ++++++-
lldb/include/lldb/Host/Config.h.cmake | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 3f75bffab0078..cf890fa9a9c44 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -68,6 +68,7 @@ add_optional_dependency(LLDB_ENABLE_TREESITTER "Enable Tree-sitter syntax highli
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
option(LLDB_ENABLE_PROTOCOL_SERVERS "Enable protocol servers (e.g. MCP) in LLDB" ON)
+option(LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS "Build the script interpreter plugins as shared libraries" OFF)
option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF)
@@ -130,9 +131,13 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
endif()
endif()
-set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+set(LLDB_EXPORT_ALL_SYMBOLS ${LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS} CACHE BOOL
"Causes lldb to export some private symbols when building liblldb. See lldb/source/API/liblldb-private.exports for the full list of symbols that get exported.")
+if (LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS AND NOT LLDB_EXPORT_ALL_SYMBOLS)
+ message(FATAL_ERROR "LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS requires LLDB_EXPORT_ALL_SYMBOLS")
+endif()
+
set(LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE "" CACHE PATH
"When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the exports file to use when building liblldb.")
diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
index 06ab9b9a7775c..ae32c001ee5dc 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -49,6 +49,8 @@
#cmakedefine01 LLDB_EMBED_PYTHON_HOME
+#cmakedefine01 LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS
+
#cmakedefine01 LLDB_ENABLE_TREESITTER
#cmakedefine01 LLDB_ENABLE_MTE
More information about the lldb-commits
mailing list