[all-commits] [llvm/llvm-project] 1ee03d: [lldb] Add ScriptedSymbolLocator plugin for source...
rchamala via All-commits
all-commits at lists.llvm.org
Sat Feb 14 07:39:23 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1ee03d1e097f05cc9811a0e4a3e7e13e35340b6d
https://github.com/llvm/llvm-project/commit/1ee03d1e097f05cc9811a0e4a3e7e13e35340b6d
Author: rchamala <36907958+rchamala at users.noreply.github.com>
Date: 2026-02-14 (Sat, 14 Feb 2026)
Changed paths:
M lldb/bindings/python/CMakeLists.txt
M lldb/bindings/python/python-swigsafecast.swig
M lldb/bindings/python/python-wrapper.swig
M lldb/docs/use/python-reference.rst
A lldb/docs/use/tutorials/scripted-symbol-locator.md
A lldb/examples/python/templates/scripted_symbol_locator.py
M lldb/include/lldb/API/SBFileSpec.h
M lldb/include/lldb/API/SBModule.h
M lldb/include/lldb/API/SBModuleSpec.h
M lldb/include/lldb/API/SBTarget.h
M lldb/include/lldb/Core/PluginManager.h
A lldb/include/lldb/Interpreter/Interfaces/ScriptedSymbolLocatorInterface.h
M lldb/include/lldb/Interpreter/ScriptInterpreter.h
M lldb/include/lldb/Symbol/LineEntry.h
M lldb/include/lldb/Target/Target.h
M lldb/include/lldb/lldb-forward.h
M lldb/include/lldb/lldb-private-interfaces.h
M lldb/source/API/SBTarget.cpp
M lldb/source/Commands/CommandObjectTarget.cpp
M lldb/source/Core/Module.cpp
M lldb/source/Core/PluginManager.cpp
M lldb/source/Interpreter/ScriptInterpreter.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
A lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedSymbolLocatorPythonInterface.cpp
A lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedSymbolLocatorPythonInterface.h
M lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
M lldb/source/Plugins/SymbolLocator/CMakeLists.txt
M lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
A lldb/source/Plugins/SymbolLocator/Scripted/CMakeLists.txt
A lldb/source/Plugins/SymbolLocator/Scripted/SymbolLocatorScripted.cpp
A lldb/source/Plugins/SymbolLocator/Scripted/SymbolLocatorScripted.h
M lldb/source/Symbol/LineEntry.cpp
M lldb/source/Target/StackFrame.cpp
M lldb/source/Target/StackFrameList.cpp
M lldb/source/Target/Target.cpp
M lldb/source/Target/ThreadPlanStepRange.cpp
A lldb/test/API/functionalities/scripted_symbol_locator/Makefile
A lldb/test/API/functionalities/scripted_symbol_locator/TestScriptedSymbolLocator.py
A lldb/test/API/functionalities/scripted_symbol_locator/main.c
A lldb/test/API/functionalities/scripted_symbol_locator/source_locator.py
M lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Log Message:
-----------
[lldb] Add ScriptedSymbolLocator plugin for source file resolution (#181334)
## Summary
Based on discussion from
[RFC](https://discourse.llvm.org/t/rfc-python-callback-for-source-file-resolution/83545),
this PR adds a new `SymbolLocatorScripted` plugin that allows Python
scripts to implement custom symbol and source file resolution logic.
This enables downstream users to build custom symbol servers, source
file remapping, and build artifact resolution entirely in Python.
### Changes
- Adds `LocateSourceFile()` to the SymbolLocator plugin interface,
called during source path resolution with a fully loaded `ModuleSP`, so
the plugin has access to the module's UUID, file paths, and symbols.
- Adds `SymbolLocatorScripted` plugin that delegates all four
SymbolLocator methods (`LocateExecutableObjectFile`,
`LocateExecutableSymbolFile`, `DownloadObjectAndSymbolFile`,
`LocateSourceFile`) to a user-provided Python class.
- Adds `ScriptedSymbolLocatorPythonInterface` to bridge C++ calls to
Python, with proper GIL management and error handling.
- Results for `LocateSourceFile` are cached per (module UUID, source
file) pair.
- The Python class is configured via: `settings set
plugin.symbol-locator.scripted.script-class module.ClassName`
### Python class interface
```python
class MyLocator:
def __init__(self, exe_ctx, args): ...
def locate_source_file(self, module, original_source_file):
...
def locate_executable_object_file(self, module_spec): ...
def locate_executable_symbol_file(self, module_spec,
default_search_paths): ...
def download_object_and_symbol_file(self, module_spec,
force_lookup, copy_executable): ...
```
### Test plan
```
Added TestScriptedSymbolLocator.py with 3 test cases:
- test_locate_source_file — verifies the locator resolves source
files, receives a valid SBModule with UUID, and remaps paths correctly
- test_locate_source_file_none_fallthrough — verifies returning
None falls through to default LLDB resolution, and that having no script
class set works normally
- test_invalid_script_class — verifies graceful handling of
invalid class names without crashing
```
Co-authored-by: Rahul Reddy Chamala <rachamal at fb.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list