================
@@ -562,17 +562,22 @@ Status ProcessMachCore::DoLoadCore() {
 
   SetCanJIT(false);
 
-  // The corefile's architecture is our best starting point.
-  ArchSpec arch(m_core_module_sp->GetArchitecture());
-  if (arch.IsValid())
-    GetTarget().SetArchitecture(arch);
-
   CreateMemoryRegions();
 
   LoadBinariesAndSetDYLD();
 
   CleanupMemoryRegionPermissions();
 
+  ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
+  if (exe_module_sp && exe_module_sp->GetArchitecture().IsValid()) {
+    GetTarget().SetArchitecture(exe_module_sp->GetArchitecture());
+  } else {
+    // The corefile's architecture is our best starting point.
+    ArchSpec arch(m_core_module_sp->GetArchitecture());
+    if (arch.IsValid())
+      GetTarget().SetArchitecture(arch);
+  }
----------------
adrian-prantl wrote:

Is this more readable? (not sure)
```
 ArchSpec arch;
 if (ModuleSP exe_module_sp = GetTarget().GetExecutableModule())
   arch = exe_module_sp->GetArchitecture();
 if (!arch.IsValid())
   // The corefile's architecture is our best starting point.
   arch = m_core_module_sp->GetArchitecture();
 if (arch.IsValid())
   GetTarget().SetArchitecture(arch);
```

https://github.com/llvm/llvm-project/pull/105576
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to