Skip to content

Commit 1fba217

Browse files
committed
Follow on to: f05dc40
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.
1 parent 118c33e commit 1fba217

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lldb/source/API/SBDebugger.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -808,13 +808,15 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename,
808808
PlatformSP platform_sp = m_opaque_sp->GetPlatformList().GetSelectedPlatform();
809809
ArchSpec arch = Platform::GetAugmentedArchSpec(
810810
platform_sp.get(), arch_cstr);
811-
error = m_opaque_sp->GetTargetList().CreateTarget(
812-
*m_opaque_sp, filename, arch,
813-
add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
814-
platform_sp, target_sp);
811+
if (arch.IsValid()) {
812+
error = m_opaque_sp->GetTargetList().CreateTarget(
813+
*m_opaque_sp, filename, arch,
814+
add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
815+
platform_sp, target_sp);
815816

816-
if (error.Success())
817-
sb_target.SetSP(target_sp);
817+
if (error.Success())
818+
sb_target.SetSP(target_sp);
819+
}
818820
}
819821

820822
LLDB_LOGF(log,

0 commit comments

Comments
 (0)