xref: /llvm-project/lldb/test/API/functionalities/target_var/TestTargetVar.py (revision 12329648e2c3f8651228f17d3619b1e1ddab80f0)
1"""
2Test that target var can resolve complex DWARF expressions.
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class targetCommandTestCase(TestBase):
12    @skipIfDarwinEmbedded  # needs x86_64
13    @skipIf(debug_info="gmodules")  # not relevant
14    @skipIf(compiler="clang", compiler_version=["<", "7.0"])
15    def testTargetVarExpr(self):
16        self.build()
17        lldbutil.run_to_name_breakpoint(self, "main")
18        self.expect(
19            "help target variable",
20            substrs=[
21                "--no-args",
22                "--no-recognized-args",
23                "--no-locals",
24                "--show-globals",
25            ],
26            matching=False,
27        )
28        self.expect("target variable i", substrs=["i", "42"])
29        self.expect(
30            "target variable var", patterns=["\(incomplete \*\) var = 0[xX](0)*dead"]
31        )
32        self.expect(
33            "target variable var[0]",
34            error=True,
35            substrs=["can't find global variable 'var[0]'"],
36        )
37