xref: /llvm-project/lldb/test/API/commands/expression/radar_8638051/Test8638051.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test the robustness of lldb expression parser.
3"""
4
5
6import lldb
7from lldbsuite.test.lldbtest import *
8
9
10class Radar8638051TestCase(TestBase):
11    def test_expr_commands(self):
12        """The following expression commands should not crash."""
13        self.build()
14
15        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
16
17        self.runCmd("breakpoint set -n c")
18
19        self.runCmd("run", RUN_SUCCEEDED)
20
21        self.expect_expr("val", result_type="int", result_value="1")
22        self.expect_expr("*(&val)", result_type="int", result_value="1")
23
24        # rdar://problem/8638051
25        # lldb expression command: Could this crash be avoided
26        self.expect("expression &val", startstr="(int *) $2 = ")
27        # (int *) $2 = 0x....
28