[Lldb-commits] [lldb] [lldb] Enable locate module callback for main executable (PR #160199)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 1 16:03:44 PDT 2025


================
@@ -1087,6 +1089,24 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
   if (module_sp)
     return error;
 
+  // Try target's platform locate module callback before second attempt
+  if (allow_locate_callback) {
+    ModuleSpec module_spec_copy(module_spec);
+    Target *target = module_spec_copy.GetTargetPtr();
+    if (target && target->IsValid()) {
+      Platform *platform = target->GetPlatform().get();
+      if (platform) {
----------------
JDevlieghere wrote:

Similar feedback as above: by only storing the pointer nothing prevents the underlying shared_ptr from going invalid behind your back. 
```suggestion
      if(lldb::PlatformSP platform_sp = target->GetPlatform()) {
```

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


More information about the lldb-commits mailing list