51 lines · python
1"""2Make sure 'frame var' using DIL parser/evaultor works for local variables.3"""4 5import lldb6from lldbsuite.test.lldbtest import *7from lldbsuite.test.decorators import *8from lldbsuite.test import lldbutil9 10import os11import shutil12import time13 14class TestFrameVarDILMemberOf(TestBase):15 # If your test case doesn't stress debug info, then16 # set this to true. That way it won't be run once for17 # each debug info format.18 NO_DEBUG_INFO_TESTCASE = True19 20 def test_frame_var(self):21 self.build()22 lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here",23 lldb.SBFileSpec("main.cpp"))24 25 self.expect("settings set target.experimental.use-DIL true",26 substrs=[""])27 self.expect_var_path("s.x", value="1")28 self.expect_var_path("s.r", type="int &")29 self.expect_var_path("sr.x", value="1")30 self.expect_var_path("sr.r", type="int &")31 self.expect_var_path("sp->x", value="1")32 self.expect_var_path("sp->r", type="int &")33 34 self.expect(35 "frame variable 'sp->foo'",36 error=True,37 substrs=['"foo" is not a member of "(Sx *) sp"'],38 )39 40 self.expect(41 "frame variable 'sp.x'",42 error=True,43 substrs=[44 "member reference type 'Sx *' is a pointer; did you mean to use '->'"45 ],46 )47 48 # Test for record typedefs.49 self.expect_var_path("sa.x", value="3")50 self.expect_var_path("sa.y", value="'\\x04'")51