Revert "Fix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT."

Also revert "Follow on to: f05dc40c31d1883b46b8bb60547087db2f4c03e3"

After these changes, multiple lldb tests are failing. Calls to
CreateTargetWithFileAndArch(None, None) appear to fail after these
changes.

This reverts commit f05dc40c31 and
1fba21778f.
This commit is contained in:
Richard Smith 2021-01-25 18:02:39 -08:00
parent 4b6d7fdd20
commit 8b11714885
2 changed files with 7 additions and 23 deletions

View File

@ -805,18 +805,14 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename,
if (m_opaque_sp) {
Status error;
const bool add_dependent_modules = true;
PlatformSP platform_sp = m_opaque_sp->GetPlatformList().GetSelectedPlatform();
ArchSpec arch = Platform::GetAugmentedArchSpec(
platform_sp.get(), arch_cstr);
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);
}
error = m_opaque_sp->GetTargetList().CreateTarget(
*m_opaque_sp, filename, arch_cstr,
add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
target_sp);
if (error.Success())
sb_target.SetSP(target_sp);
}
LLDB_LOGF(log,

View File

@ -476,15 +476,3 @@ class TargetAPITestCase(TestBase):
desc2 = get_description(symbol2)
self.assertTrue(desc1 and desc2 and desc1 == desc2,
"The two addresses should resolve to the same symbol")
def test_default_arch(self):
""" Test the other two target create methods using LLDB_ARCH_DEFAULT. """
self.build()
exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTargetWithFileAndArch(exe, lldb.LLDB_ARCH_DEFAULT)
self.assertTrue(target.IsValid(), "Default arch made a valid target.")
# This should also work with the target's triple:
target2 = self.dbg.CreateTargetWithFileAndArch(exe, target.GetTriple())
self.assertTrue(target2.IsValid(), "Round trip with triple works")
# And this triple should work for the FileAndTriple API:
target3 = self.dbg.CreateTargetWithFileAndTargetTriple(exe, target.GetTriple())
self.assertTrue(target3.IsValid())