| 1 |
""" |
| 2 |
Make sure 'frame var' using DIL parser/evaultor works for local variables. |
| 3 |
""" |
| 4 |
|
| 5 |
import lldb |
| 6 |
from lldbsuite.test.lldbtest import * |
| 7 |
from lldbsuite.test.decorators import * |
| 8 |
from lldbsuite.test import lldbutil |
| 9 |
|
| 10 |
import os |
| 11 |
import shutil |
| 12 |
import time |
| 13 |
|
| 14 |
|
| 15 |
class TestFrameVarDILGlobalVariableLookup(TestBase): |
| 16 |
# If your test case doesn't stress debug info, then |
| 17 |
# set this to true. That way it won't be run once for |
| 18 |
# each debug info format. |
| 19 |
NO_DEBUG_INFO_TESTCASE = True |
| 20 |
|
| 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") # 0xDEADBEEF |
| 39 |
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 global |
| 60 |
self.expect_var_path("foo", value="1") |
| 61 |
self.expect_var_path("::foo", value="2") |