[Lldb-commits] [lldb] Properly handle locate module callback while overriding (PR #143793)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 11 15:04:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (GeorgeHuyubo)

<details>
<summary>Changes</summary>

Since this PR: https://github.com/llvm/llvm-project/pull/141670/

We start to override the Platform/Arch for a target if needed. However we may have already registered locate module callback with the old platform. So this fix will just ensure to set the callback to the new platform object.

---
Full diff: https://github.com/llvm/llvm-project/pull/143793.diff


1 Files Affected:

- (modified) lldb/source/Target/Target.cpp (+2) 


``````````diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 9660fc97970b0..45a9e1196a049 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1706,6 +1706,8 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform,
         if (PlatformSP arch_platform_sp =
                 GetDebugger().GetPlatformList().GetOrCreate(other, {},
                                                             &platform_arch)) {
+          arch_platform_sp->SetLocateModuleCallback(
+              platform_sp->GetLocateModuleCallback());
           SetPlatform(arch_platform_sp);
           if (platform_arch.IsValid())
             other = platform_arch;

``````````

</details>


https://github.com/llvm/llvm-project/pull/143793


More information about the lldb-commits mailing list