@@ -8,28 +8,28 @@ class TestCase(lldbtest.TestBase):
8
8
9
9
mydir = lldbtest .TestBase .compute_mydir (__file__ )
10
10
11
+ def read_ptr_from_memory (self , process , addr ):
12
+ error = lldb .SBError ()
13
+ value = process .ReadPointerFromMemory (addr , error )
14
+ self .assertSuccess (error , "Failed to read memory" )
15
+ return value
16
+
11
17
# Check that the CFA chain is correctly built
12
18
def check_cfas (self , async_frames , process ):
13
19
async_cfas = list (map (lambda frame : frame .GetCFA (), async_frames ))
14
20
expected_cfas = [async_cfas [0 ]]
15
21
# The CFA chain ends in nullptr.
16
22
while expected_cfas [- 1 ] != 0 :
17
- error = lldb .SBError ()
18
- expected_cfas .append (
19
- process .ReadPointerFromMemory (expected_cfas [- 1 ], error )
20
- )
21
- self .assertSuccess (error , "Managed to read cfa memory" )
23
+ expected_cfas .append (self .read_ptr_from_memory (process , expected_cfas [- 1 ]))
22
24
23
25
self .assertEqual (async_cfas , expected_cfas [:- 1 ])
24
26
25
27
def check_pcs (self , async_frames , process , target ):
26
28
for idx , frame in enumerate (async_frames [:- 1 ]):
27
29
# Read the continuation pointer from the second field of the CFA.
28
- error = lldb .SBError ()
29
- continuation_ptr = process .ReadPointerFromMemory (
30
- frame .GetCFA () + target .addr_size , error
30
+ continuation_ptr = self .read_ptr_from_memory (
31
+ process , frame .GetCFA () + target .addr_size
31
32
)
32
- self .assertSuccess (error , "Managed to read context memory" )
33
33
34
34
# The PC of the previous frame should be the continuation pointer
35
35
# with the funclet's prologue skipped.
@@ -39,7 +39,7 @@ def check_pcs(self, async_frames, process, target):
39
39
40
40
41
41
def check_variables (self , async_frames , expected_values ):
42
- for ( frame , expected_value ) in zip (async_frames , expected_values ):
42
+ for frame , expected_value in zip (async_frames , expected_values ):
43
43
myvar = frame .FindVariable ("myvar" )
44
44
lldbutil .check_variable (self , myvar , False , value = expected_value )
45
45
0 commit comments