Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / linux / aarch64 / non_address_bit_code_break / TestAArch64LinuxNonAddressBitCodeBreak.py
blobe6baa5d8f59d71a470f3fac0105138ba26cc62c4
1 """
2 Test that "breakpoint set -a" uses the ABI plugin to remove non-address bits
3 before attempting to set a breakpoint.
4 """
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class AArch64LinuxNonAddressBitCodeBreak(TestBase):
13 NO_DEBUG_INFO_TESTCASE = True
15 def do_tagged_break(self, hardware):
16 if not self.isAArch64PAuth():
17 self.skipTest("Target must support pointer authentication.")
19 self.build()
20 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
22 lldbutil.run_break_set_by_file_and_line(
23 self,
24 "main.c",
25 line_number("main.c", "// Set break point at this line."),
26 num_expected_locations=1,
29 self.runCmd("run", RUN_SUCCEEDED)
31 if self.process().GetState() == lldb.eStateExited:
32 self.fail("Test program failed to run.")
34 self.expect(
35 "thread list",
36 STOPPED_DUE_TO_BREAKPOINT,
37 substrs=["stopped", "stop reason = breakpoint"],
40 cmd = "breakpoint set -a fnptr"
41 # LLDB only has the option to force hardware break, not software.
42 # It prefers sofware break when it can and this will be one of those cases.
43 if hardware:
44 cmd += " --hardware"
45 self.expect(cmd)
47 self.runCmd("continue")
48 self.assertEqual(self.process().GetState(), lldb.eStateStopped)
49 self.expect(
50 "thread list",
51 STOPPED_DUE_TO_BREAKPOINT,
52 substrs=["stopped", "`foo at main.c", "stop reason = breakpoint"],
55 # AArch64 Linux always enables the top byte ignore feature
56 @skipUnlessArch("aarch64")
57 @skipUnlessPlatform(["linux"])
58 def test_software_break(self):
59 self.do_tagged_break(False)
61 @skipUnlessArch("aarch64")
62 @skipUnlessPlatform(["linux"])
63 def test_hardware_break(self):
64 self.do_tagged_break(True)