diff options
| author | Jim Ingham <jingham@apple.com> | 2021-01-26 12:15:09 -0800 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2021-01-26 12:17:39 -0800 |
| commit | 7636b1f6efd56063adcde4f908740660365462a5 (patch) | |
| tree | e7f87613746f7614fcdbc4595c256aecfdac0962 /lldb/test/API/python_api/target/TestTargetAPI.py | |
| parent | d2abd62b9d123cde5a55a92450bbe665b237a72d (diff) | |
Make SBDebugger::CreateTargetWithFileAndArch work with lldb::LLDB_DEFAULT_ARCH
Second try, handling both a bogus arch string and the "null file & arch" used
to create an empty but valid target.
Also check in that case before logging (previously the logging would have
crashed.)
Diffstat (limited to 'lldb/test/API/python_api/target/TestTargetAPI.py')
| -rw-r--r-- | lldb/test/API/python_api/target/TestTargetAPI.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py index f058a0a732c2..12c9d9d59aed 100644 --- a/lldb/test/API/python_api/target/TestTargetAPI.py +++ b/lldb/test/API/python_api/target/TestTargetAPI.py @@ -476,3 +476,16 @@ 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()) + |
