[AMDGPU][True16][CodeGen] true16 codegen pattern for f16 canonicalize (#122000)
[llvm-project.git] / lldb / test / API / functionalities / unwind / aarch64_unwind_pac / TestAArch64UnwindPAC.py
blob17e120d93f065eb252969b254f9d7f7f9e5e6474
1 """
2 Test that we can backtrace correctly when AArch64 PAC is enabled
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
11 class AArch64UnwindPAC(TestBase):
12 @skipIf(archs=no_match(["aarch64"]))
13 @skipIf(oslist=no_match(["linux"]))
14 def test(self):
15 """Test that we can backtrace correctly when AArch64 PAC is enabled"""
16 if not self.isAArch64PAuth():
17 self.skipTest("Target must support Pointer Authentication.")
19 self.build()
21 self.line = line_number("main.c", "// Frame func_c")
23 exe = self.getBuildArtifact("a.out")
24 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
26 lldbutil.run_break_set_by_file_and_line(
27 self, "main.c", self.line, num_expected_locations=1
29 self.runCmd("run", RUN_SUCCEEDED)
30 self.expect(
31 "thread backtrace",
32 STOPPED_DUE_TO_BREAKPOINT,
33 substrs=["stop reason = breakpoint 1."],
36 target = self.dbg.GetSelectedTarget()
37 process = target.GetProcess()
38 thread = process.GetThreadAtIndex(0)
40 backtrace = [
41 "func_c",
42 "func_b",
43 "func_a",
44 "main",
47 libc_backtrace = [
48 "__libc_start_main",
49 "_start",
52 self.assertGreaterEqual(
53 thread.GetNumFrames(), len(backtrace) + len(libc_backtrace)
56 # Strictly check frames that are in the test program's source.
57 for frame_idx, frame in enumerate(thread.frames[: len(backtrace)]):
58 self.assertTrue(frame)
59 self.assertEqual(frame.GetFunctionName(), backtrace[frame_idx])
60 self.assertEqual(
61 frame.GetLineEntry().GetLine(),
62 line_number("main.c", "Frame " + backtrace[frame_idx]),
65 # After the program comes some libc frames. The number varies by
66 # system, so ensure we have at least these two in this order,
67 # skipping frames in between.
68 start_idx = frame_idx + 1
69 for frame_idx, frame in enumerate(thread.frames[start_idx:], start=start_idx):
70 self.assertTrue(frame)
71 if libc_backtrace[0] == frame.GetFunctionName():
72 libc_backtrace.pop(0)
74 self.assertFalse(libc_backtrace, "Did not find expected libc frames.")