xref: /llvm-project/lldb/test/API/lang/cpp/gmodules/pch-chain/TestPchChain.py (revision 252f3c98db1383ee0e1f25020d488ffb7b4ac392)
1*252f3c98SMichael Buch"""
2*252f3c98SMichael BuchTests that we correctly track AST layout info
3*252f3c98SMichael Buch(specifically alignment) when moving AST nodes
4*252f3c98SMichael Buchbetween several ClangASTImporter instances
5*252f3c98SMichael Buch(in this case, from a pch chain to executable
6*252f3c98SMichael Buchto expression AST).
7*252f3c98SMichael Buch"""
8*252f3c98SMichael Buch
9*252f3c98SMichael Buchimport lldb
10*252f3c98SMichael Buchimport os
11*252f3c98SMichael Buchfrom lldbsuite.test.decorators import *
12*252f3c98SMichael Buchfrom lldbsuite.test.lldbtest import *
13*252f3c98SMichael Buchfrom lldbsuite.test import lldbutil
14*252f3c98SMichael Buch
15*252f3c98SMichael Buch
16*252f3c98SMichael Buchclass TestPchChain(TestBase):
17*252f3c98SMichael Buch    @add_test_categories(["gmodules"])
18*252f3c98SMichael Buch    @expectedFailureAll("Chained pch debugging currently not fully supported")
19*252f3c98SMichael Buch    def test_expr(self):
20*252f3c98SMichael Buch        self.build()
21*252f3c98SMichael Buch        exe = self.getBuildArtifact("a.out")
22*252f3c98SMichael Buch        self.target = self.dbg.CreateTarget(exe)
23*252f3c98SMichael Buch        self.assertTrue(self.target, VALID_TARGET)
24*252f3c98SMichael Buch        lldbutil.run_break_set_by_file_and_line(
25*252f3c98SMichael Buch            self, "main.cpp", 9, num_expected_locations=1
26*252f3c98SMichael Buch        )
27*252f3c98SMichael Buch
28*252f3c98SMichael Buch        self.runCmd("run", RUN_SUCCEEDED)
29*252f3c98SMichael Buch
30*252f3c98SMichael Buch        self.expect(
31*252f3c98SMichael Buch            "frame variable data",
32*252f3c98SMichael Buch            substrs=["row = 1", "col = 2", "row = 3", "col = 4", "stride = 5"],
33*252f3c98SMichael Buch        )
34*252f3c98SMichael Buch
35*252f3c98SMichael Buch    @add_test_categories(["gmodules"])
36*252f3c98SMichael Buch    @expectedFailureAll("Chained pch debugging currently not fully supported")
37*252f3c98SMichael Buch    def test_frame_var(self):
38*252f3c98SMichael Buch        self.build()
39*252f3c98SMichael Buch        exe = self.getBuildArtifact("a.out")
40*252f3c98SMichael Buch        self.target = self.dbg.CreateTarget(exe)
41*252f3c98SMichael Buch        self.assertTrue(self.target, VALID_TARGET)
42*252f3c98SMichael Buch        lldbutil.run_break_set_by_file_and_line(
43*252f3c98SMichael Buch            self, "main.cpp", 9, num_expected_locations=1
44*252f3c98SMichael Buch        )
45*252f3c98SMichael Buch
46*252f3c98SMichael Buch        self.runCmd("run", RUN_SUCCEEDED)
47*252f3c98SMichael Buch
48*252f3c98SMichael Buch        self.expect_expr(
49*252f3c98SMichael Buch            "data",
50*252f3c98SMichael Buch            result_type="MatrixData",
51*252f3c98SMichael Buch            result_children=[
52*252f3c98SMichael Buch                ValueCheck(
53*252f3c98SMichael Buch                    name="section",
54*252f3c98SMichael Buch                    children=[
55*252f3c98SMichael Buch                        ValueCheck(
56*252f3c98SMichael Buch                            name="origin",
57*252f3c98SMichael Buch                            children=[
58*252f3c98SMichael Buch                                ValueCheck(name="row", value="1"),
59*252f3c98SMichael Buch                                ValueCheck(name="col", value="2"),
60*252f3c98SMichael Buch                            ],
61*252f3c98SMichael Buch                        ),
62*252f3c98SMichael Buch                        ValueCheck(
63*252f3c98SMichael Buch                            name="size",
64*252f3c98SMichael Buch                            children=[
65*252f3c98SMichael Buch                                ValueCheck(name="row", value="3"),
66*252f3c98SMichael Buch                                ValueCheck(name="col", value="4"),
67*252f3c98SMichael Buch                            ],
68*252f3c98SMichael Buch                        ),
69*252f3c98SMichael Buch                    ],
70*252f3c98SMichael Buch                ),
71*252f3c98SMichael Buch                ValueCheck(name="stride", value="5"),
72*252f3c98SMichael Buch            ],
73*252f3c98SMichael Buch        )
74