================
@@ -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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to