brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · c9dcf30 Raw
57 lines · python
1"""2Tests that C++ member and static variables are available where they should be.3"""4import lldb5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class CPPThisTestCase(TestBase):11    # rdar://problem/996284912    @expectedFailureAll(13        compiler="gcc",14        bugnumber="llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function",15    )16    @expectedFailureAll(17        compiler="icc",18        bugnumber="ICC doesn't emit correct DWARF inline debug info for inlined member functions.",19    )20    @expectedFailureAll(21        oslist=["windows"],22        bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows",23    )24    def test_with_run_command(self):25        """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""26        self.build()27        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)28 29        self.set_breakpoint(line_number("main.cpp", "// breakpoint 1"))30        self.set_breakpoint(line_number("main.cpp", "// breakpoint 2"))31        self.set_breakpoint(line_number("main.cpp", "// breakpoint 3"))32        self.set_breakpoint(line_number("main.cpp", "// breakpoint 4"))33 34        self.runCmd("process launch", RUN_SUCCEEDED)35 36        self.expect("expression -- m_a = 2", startstr="(int) $0 = 2")37 38        self.runCmd("process continue")39 40        # This would be disallowed if we enforced const.  But we don't.41        self.expect("expression -- m_a = 2", startstr="(int) $1 = 2")42 43        self.expect("expression -- (int)getpid(); m_a", startstr="(int) $2 = 2")44 45        self.runCmd("process continue")46 47        self.expect("expression -- s_a", startstr="(int) $3 = 5")48 49        self.runCmd("process continue")50 51        self.expect("expression -- m_a", startstr="(int) $4 = 2")52 53    def set_breakpoint(self, line):54        lldbutil.run_break_set_by_file_and_line(55            self, "main.cpp", line, num_expected_locations=1, loc_exact=False56        )57