2 Test that "memory region" command can show memory tagged regions
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
13 class AArch64LinuxMTEMemoryRegionTestCase(TestBase
):
14 NO_DEBUG_INFO_TESTCASE
= True
16 @skipUnlessArch("aarch64")
17 @skipUnlessPlatform(["linux"])
18 @skipUnlessAArch64MTELinuxCompiler
19 def test_mte_regions(self
):
20 if not self
.isAArch64MTE():
21 self
.skipTest("Target must support MTE.")
23 # This test assumes that we have /proc/<PID>/smaps files
24 # that include "VmFlags:" lines.
25 # AArch64 kernel config defaults to enabling smaps with
26 # PROC_PAGE_MONITOR and "VmFlags" was added in kernel 3.8,
27 # before MTE was supported at all.
30 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
32 lldbutil
.run_break_set_by_file_and_line(
35 line_number("main.c", "// Set break point at this line."),
36 num_expected_locations
=1,
39 self
.runCmd("run", RUN_SUCCEEDED
)
41 if self
.process().GetState() == lldb
.eStateExited
:
42 self
.fail("Test program failed to run.")
46 STOPPED_DUE_TO_BREAKPOINT
,
47 substrs
=["stopped", "stop reason = breakpoint"],
50 substrs
= ["memory tagging: enabled"]
51 # The new page will be tagged
52 self
.expect("memory region the_page", substrs
=substrs
)
53 # Code page will not be
54 self
.expect("memory region main", substrs
=substrs
, matching
=False)