1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6 7class TestArm64eAttach(TestBase): 8 NO_DEBUG_INFO_TESTCASE = True 9 10 # On Darwin systems, arch arm64e means ARMv8.3 with ptrauth ABI used. 11 @skipIf(archs=no_match(["arm64e"])) 12 def test(self): 13 # Skip this test if not running on AArch64 target that supports PAC 14 if not self.isAArch64PAuth(): 15 self.skipTest("Target must support pointer authentication.") 16 17 self.build() 18 popen = self.spawnSubprocess(self.getBuildArtifact(), []) 19 20 # This simulates how Xcode attaches to a process by pid/name. 21 error = lldb.SBError() 22 target = self.dbg.CreateTarget("", "arm64", "", True, error) 23 listener = lldb.SBListener("my.attach.listener") 24 process = target.AttachToProcessWithID(listener, popen.pid, error) 25 self.assertSuccess(error) 26 self.assertTrue(process, PROCESS_IS_VALID) 27 self.assertEqual(target.GetTriple().split('-')[0], "arm64e", 28 "target triple is updated correctly") 29 30 self.expect('process plugin packet send qProcessInfo', 31 "debugserver returns correct triple", 32 substrs=['cputype:100000c', 'cpusubtype:2', 'ptrsize:8']) 33 34 error = process.Kill() 35 self.assertSuccess(error) 36