[Lldb-commits] [lldb] [lldb] Pick the correct architecutre when target and core file disagree (PR #105576)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 23 14:49:32 PDT 2024
================
@@ -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
More information about the lldb-commits
mailing list