2 Test changing setting for expression memory allocation.
6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 from lldbsuite
.test
import lldbutil
11 class TestMemoryAllocSettings(TestBase
):
13 """Test changing settings for expression memory allocation."""
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
:
30 alloc0
= re
.search("^.*IRMemoryMap::Malloc.+?0xdead0000.*$", log
, re
.MULTILINE
)
31 # Malloc adds additional bytes to allocation size, hence 10007
33 "^.*IRMemoryMap::Malloc\s*?\(10007.+?0xdead1000.*$", log
, re
.MULTILINE
35 self
.assertTrue(alloc0
, "Couldn't find an allocation at a given address.")
37 alloc1
, "Couldn't find an allocation of a given size at a given address."