When you pass in a bogus ArchSpec, TargetList.CreateTarget
makes a target with the arch of the executable.  That wasn't the
case with a bogus triple, so this change caused one of the bogus
input data tests to fail.  So check that the ArchSpec is valid
before passing it to CreateTarget.
This commit is contained in:
Jim Ingham 2021-01-25 14:23:11 -08:00
parent 118c33ef47
commit 1fba21778f
1 changed files with 8 additions and 6 deletions

View File

@ -808,13 +808,15 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename,
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,