[Lldb-commits] [lldb] de4f473 - [lldb] Fix Windows linker error for MakeSBModuleSpec in lldb-server (#181494)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Feb 14 10:12:49 PST 2026
Author: rchamala
Date: 2026-02-14T10:12:44-08:00
New Revision: de4f473f884e1b59378bf04d37023f6fc7f3601a
URL: https://github.com/llvm/llvm-project/commit/de4f473f884e1b59378bf04d37023f6fc7f3601a
DIFF: https://github.com/llvm/llvm-project/commit/de4f473f884e1b59378bf04d37023f6fc7f3601a.diff
LOG: [lldb] Fix Windows linker error for MakeSBModuleSpec in lldb-server (#181494)
## Summary
Move the definition of `ScriptInterpreter::MakeSBModuleSpec` from
`ScriptInterpreter.cpp` to `ScriptedPythonInterface.cpp`.
`MakeSBModuleSpec` constructs an `SBModuleSpec`, whose symbols live in
the API library (`liblldb`). `ScriptInterpreter.cpp` is part of
`lldbInterpreter`, which is also linked into `lldb-server` — and
`lldb-server` does not link the API library. On Windows, this causes
`LNK2019: unresolved external symbol` for `SBModuleSpec`'s constructor
and destructor.
`ScriptedPythonInterface.cpp` is part of the Python plugin library,
which only links into `liblldb` where the API symbols are available. The
method retains friend access to `SBModuleSpec` since it is still a
member of `ScriptInterpreter` regardless of which `.cpp` file defines
it.
Fixes Windows linker failure from #181334.
## Test plan
- [ ] Existing ScriptedSymbolLocator tests pass
Co-authored-by: Rahul Reddy Chamala <rachamal at meta.com>
Added:
Modified:
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
Removed:
################################################################################
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index 9e2cad22ad6e6..35fc59c904955 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -191,12 +191,6 @@ lldb::ModuleSP ScriptInterpreter::GetOpaqueTypeFromSBModule(
return module.m_opaque_sp;
}
-std::unique_ptr<lldb::SBModuleSpec>
-ScriptInterpreter::MakeSBModuleSpec(const ModuleSpec &module_spec) const {
- return std::unique_ptr<lldb::SBModuleSpec>(
- new lldb::SBModuleSpec(module_spec));
-}
-
lldb::ScriptLanguage
ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) {
if (language.equals_insensitive(LanguageToString(eScriptLanguageNone)))
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
index 92438cf51928d..f147b50d20c9b 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
@@ -378,4 +378,14 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::ModuleSP>(
return {};
}
+// MakeSBModuleSpec is defined here rather than in ScriptInterpreter.cpp
+// because it constructs an SBModuleSpec, whose symbols live in liblldb.
+// ScriptInterpreter.cpp is part of lldbInterpreter which is also linked
+// into lldb-server, which does not link the API library.
+std::unique_ptr<lldb::SBModuleSpec>
+ScriptInterpreter::MakeSBModuleSpec(const ModuleSpec &module_spec) const {
+ return std::unique_ptr<lldb::SBModuleSpec>(
+ new lldb::SBModuleSpec(module_spec));
+}
+
#endif
More information about the lldb-commits
mailing list