xref: /llvm-project/lldb/test/API/commands/watchpoints/watchpoint_on_vectors/TestValueOfVectorVariable.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test displayed value of a vector variable while doing watchpoint operations
3"""
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class TestValueOfVectorVariableTestCase(TestBase):
13    NO_DEBUG_INFO_TESTCASE = True
14
15    def test_value_of_vector_variable_using_watchpoint_set(self):
16        """Test verify displayed value of vector variable."""
17        exe = self.getBuildArtifact("a.out")
18        d = {"C_SOURCES": self.source, "EXE": exe}
19        self.build(dictionary=d)
20        self.setTearDownCleanup(dictionary=d)
21        self.value_of_vector_variable_with_watchpoint_set()
22
23    def setUp(self):
24        # Call super's setUp().
25        TestBase.setUp(self)
26        # Our simple source filename.
27        self.source = "main.c"
28
29    def value_of_vector_variable_with_watchpoint_set(self):
30        """Test verify displayed value of vector variable"""
31        exe = self.getBuildArtifact("a.out")
32        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
33
34        # Set break to get a frame
35        self.runCmd("b main")
36
37        # Run the program.
38        self.runCmd("run", RUN_SUCCEEDED)
39
40        # Value of a vector variable should be displayed correctly
41        self.expect(
42            "watchpoint set variable global_vector",
43            WATCHPOINT_CREATED,
44            substrs=["new value: (1, 2, 3, 4)"],
45        )
46