From b1f5e26b78a9550a22ee2f24bb3f220d396c452f Mon Sep 17 00:00:00 2001 From: GeorgeHuyubo <113479859+GeorgeHuyubo@users.noreply.github.com> Date: Thu, 12 Jun 2025 13:23:26 -0700 Subject: [lldb] Properly handle locate module callback when Target change arch (#143793) Since this PR: https://github.com/llvm/llvm-project/pull/141670/ We started to override the Platform/Arch for a target if needed. However we may have already registered locate module callback with the old platform. This PR will move the locate module callback to the new Platform whenever Target changes architecture. Co-authored-by: George Hu --- lldb/source/Target/Target.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lldb/source/Target/Target.cpp') diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 9660fc97970b..45a9e1196a04 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; -- cgit v1.2.3