[Lldb-commits] [lldb] [lldb] Preserve TargetSP in Platform module lookup (PR #186323)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 12 23:28:53 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Emre Kultursay (emrekultursay)
<details>
<summary>Changes</summary>
When `Platform::GetRemoteSharedModule` resolves a module specification by calling `GetModuleSpec` on the process, the target context (`TargetSP`) is lost. This happens because the underlying process plugin populates a new `ModuleSpec` object that does not inherit the target context.
This causes failures in subsequent symbol resolution steps. For example, when `ModuleList` relies on the `TargetSP` to query target-specific settings like `target.exec-search-paths` and `target.symbols-search-paths`, the lookup fails because `TargetSP` evaluates to null. This prevents LLDB from finding local unstripped libraries.
This commit fixes the issue by transferring the target context from the original `module_spec` over to the `resolved_module_spec` before proceeding with the lookup.
---
Full diff: https://github.com/llvm/llvm-project/pull/186323.diff
1 Files Affected:
- (modified) lldb/source/Target/Platform.cpp (+4)
``````````diff
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index c47ef47b0f60c..181adcaac00c0 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1525,6 +1525,10 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
resolved_module_spec.GetUUID() = module_spec.GetUUID();
}
+ // Retain the target context from the original module_spec since
+ // process->GetModuleSpec might have cleared it.
+ resolved_module_spec.SetTarget(module_spec.GetTargetSP());
+
// Call locate module callback if set. This allows users to implement their
// own module cache system. For example, to leverage build system artifacts,
// to bypass pulling files from remote platform, or to search symbol files
``````````
</details>
https://github.com/llvm/llvm-project/pull/186323
More information about the lldb-commits
mailing list