[LLD][COFF] Emit locally imported EC symbols for ARM64X (#125527)
[llvm-project.git] / lldb / test / API / commands / expression / memory-allocation / TestMemoryAllocSettings.py
blobd27f07717affb8bdcef68b5ade0a798b2e4836bc
1 """
2 Test changing setting for expression memory allocation.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
11 class TestMemoryAllocSettings(TestBase):
12 def test(self):
13 """Test changing settings for expression memory allocation."""
14 self.build()
15 target = self.createTestTarget()
17 self.log_file = self.getBuildArtifact("log-expr.txt")
19 self.runCmd("settings set target.expr-alloc-address 0xdead0000")
20 self.runCmd("settings set target.expr-alloc-size 10000")
21 self.runCmd("settings set target.expr-alloc-align 0x1000")
23 self.runCmd("log enable lldb expr -f " + self.log_file)
24 self.runCmd("expression -- int foo; &foo")
26 self.assertTrue(os.path.isfile(self.log_file))
27 with open(self.log_file, "r") as f:
28 log = f.read()
30 alloc0 = re.search("^.*IRMemoryMap::Malloc.+?0xdead0000.*$", log, re.MULTILINE)
31 # Malloc adds additional bytes to allocation size, hence 10007
32 alloc1 = re.search(
33 "^.*IRMemoryMap::Malloc\s*?\(10007.+?0xdead1000.*$", log, re.MULTILINE
35 self.assertTrue(alloc0, "Couldn't find an allocation at a given address.")
36 self.assertTrue(
37 alloc1, "Couldn't find an allocation of a given size at a given address."