PlatformSP platform_sp = m_opaque_sp->GetPlatformList().GetSelectedPlatform();
ArchSpec arch = Platform::GetAugmentedArchSpec(
platform_sp.get(), arch_cstr);
- error = m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, arch,
- add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
- platform_sp, target_sp);
+ if (arch.IsValid()) {
+ error = m_opaque_sp->GetTargetList().CreateTarget(
+ *m_opaque_sp, filename, arch,
+ add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
+ platform_sp, target_sp);
- if (error.Success())
- sb_target.SetSP(target_sp);
+ if (error.Success())
+ sb_target.SetSP(target_sp);
+ }
}
LLDB_LOGF(log,