7
7
8
8
9
9
class LocationListLookupTestCase (TestBase ):
10
- @skipIf (oslist = ["linux" ], archs = ["arm" ])
11
- def test_loclist (self ):
12
- self .build ()
13
-
10
+ def launch (self ) -> lldb .SBProcess :
14
11
exe = self .getBuildArtifact ("a.out" )
15
12
target = self .dbg .CreateTarget (exe )
16
13
self .assertTrue (target , VALID_TARGET )
@@ -22,15 +19,31 @@ def test_loclist(self):
22
19
self .assertTrue (process .IsValid ())
23
20
self .assertTrue (process .is_stopped )
24
21
22
+ return process
23
+
24
+ def check_local_vars (self , process : lldb .SBProcess , check_expr : bool ):
25
25
# Find `bar` on the stack, then
26
26
# make sure we can read out the local
27
27
# variables (with both `frame var` and `expr`)
28
28
for f in process .GetSelectedThread ().frames :
29
- if f .GetDisplayFunctionName ().startswith ("Foo::bar" ):
29
+ frame_name = f .GetDisplayFunctionName ()
30
+ if frame_name is not None and frame_name .startswith ("Foo::bar" ):
30
31
argv = f .GetValueForVariablePath ("argv" ).GetChildAtIndex (0 )
31
32
strm = lldb .SBStream ()
32
33
argv .GetDescription (strm )
33
34
self .assertNotEqual (strm .GetData ().find ("a.out" ), - 1 )
34
35
35
- process .GetSelectedThread ().SetSelectedFrame (f .idx )
36
- self .expect_expr ("this" , result_type = "Foo *" )
36
+ if check_expr :
37
+ process .GetSelectedThread ().SetSelectedFrame (f .idx )
38
+ self .expect_expr ("this" , result_type = "Foo *" )
39
+
40
+ @skipIf (oslist = ["linux" ], archs = ["arm" ])
41
+ @skipIfDarwin
42
+ def test_loclist_frame_var (self ):
43
+ self .build ()
44
+ self .check_local_vars (self .launch (), check_expr = False )
45
+
46
+ @skipUnlessDarwin
47
+ def test_loclist_expr (self ):
48
+ self .build ()
49
+ self .check_local_vars (self .launch (), check_expr = True )
0 commit comments