xref: /llvm-project/lldb/test/API/functionalities/target_var/TestTargetVar.py (revision 12329648e2c3f8651228f17d3619b1e1ddab80f0)
199451b44SJordan Rupprecht"""
299451b44SJordan RupprechtTest that target var can resolve complex DWARF expressions.
399451b44SJordan Rupprecht"""
499451b44SJordan Rupprecht
599451b44SJordan Rupprechtimport lldb
699451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
799451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
899451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
999451b44SJordan Rupprecht
1099451b44SJordan Rupprecht
1199451b44SJordan Rupprechtclass targetCommandTestCase(TestBase):
1299451b44SJordan Rupprecht    @skipIfDarwinEmbedded  # needs x86_64
1399451b44SJordan Rupprecht    @skipIf(debug_info="gmodules")  # not relevant
142238dcc3SJonas Devlieghere    @skipIf(compiler="clang", compiler_version=["<", "7.0"])
1599451b44SJordan Rupprecht    def testTargetVarExpr(self):
1699451b44SJordan Rupprecht        self.build()
172238dcc3SJonas Devlieghere        lldbutil.run_to_name_breakpoint(self, "main")
18*12329648SFelipe de Azevedo Piovezan        self.expect(
19*12329648SFelipe de Azevedo Piovezan            "help target variable",
20*12329648SFelipe de Azevedo Piovezan            substrs=[
21*12329648SFelipe de Azevedo Piovezan                "--no-args",
22*12329648SFelipe de Azevedo Piovezan                "--no-recognized-args",
23*12329648SFelipe de Azevedo Piovezan                "--no-locals",
24*12329648SFelipe de Azevedo Piovezan                "--show-globals",
25*12329648SFelipe de Azevedo Piovezan            ],
26*12329648SFelipe de Azevedo Piovezan            matching=False,
27*12329648SFelipe de Azevedo Piovezan        )
282238dcc3SJonas Devlieghere        self.expect("target variable i", substrs=["i", "42"])
292238dcc3SJonas Devlieghere        self.expect(
302238dcc3SJonas Devlieghere            "target variable var", patterns=["\(incomplete \*\) var = 0[xX](0)*dead"]
312238dcc3SJonas Devlieghere        )
322238dcc3SJonas Devlieghere        self.expect(
332238dcc3SJonas Devlieghere            "target variable var[0]",
342238dcc3SJonas Devlieghere            error=True,
352238dcc3SJonas Devlieghere            substrs=["can't find global variable 'var[0]'"],
362238dcc3SJonas Devlieghere        )
37