62 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 14 15class TestFrameVarDILGlobalVariableLookup(TestBase):16 # If your test case doesn't stress debug info, then17 # set this to true. That way it won't be run once for18 # each debug info format.19 NO_DEBUG_INFO_TESTCASE = True20 21 @skipIf(macos_version=["<", "15.0"], archs=["arm64", "arm64e"])22 @skipIf(23 dwarf_version=["<", "5"],24 oslist=[lldbplatformutil.getDarwinOSTriples()],25 )26 @expectedFailureAll(27 compiler="clang",28 compiler_version=["<", "19.0"],29 oslist=[lldbplatformutil.getDarwinOSTriples()],30 )31 def test_frame_var(self):32 self.build()33 lldbutil.run_to_source_breakpoint(34 self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp")35 )36 37 self.runCmd("settings set target.experimental.use-DIL true")38 self.expect_var_path("globalVar", type="int", value="-559038737") # 0xDEADBEEF39 self.expect_var_path("globalPtr", type="int *")40 self.expect_var_path("globalRef", type="int &")41 self.expect_var_path("::globalVar", value="-559038737")42 self.expect_var_path("::globalPtr", type="int *")43 self.expect_var_path("::globalRef", type="int &")44 45 self.expect_var_path("ns::globalVar", value="13")46 self.expect_var_path("ns::globalPtr", type="int *")47 self.expect_var_path("ns::globalRef", type="int &")48 self.expect_var_path("::ns::globalVar", value="13")49 self.expect_var_path("::ns::globalPtr", type="int *")50 self.expect_var_path("::ns::globalRef", type="int &")51 52 self.expect_var_path("externGlobalVar", value="2")53 self.expect_var_path("::externGlobalVar", value="2")54 self.expect_var_path("ext::externGlobalVar", value="4")55 self.expect_var_path("::ext::externGlobalVar", value="4")56 57 self.expect_var_path("ExtStruct::static_inline", value="16")58 59 # Test local variable priority over global60 self.expect_var_path("foo", value="1")61 self.expect_var_path("::foo", value="2")62