[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:16 PDT 2025


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

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.

>From 53b82174a8c84ee9b4eff172dc106ba1e2e5f5f5 Mon Sep 17 00:00:00 2001
From: George Hu <georgehuyubo at gmail.com>
Date: Wed, 11 Jun 2025 14:59:14 -0700
Subject: [PATCH] Properly handle locate module callback while overriding

---
 lldb/source/Target/Target.cpp | 2 ++
 1 file changed, 2 insertions(+)

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;



More information about the lldb-commits mailing list