3eb3a86adf235fe72d0fb45ce0b700f0da92dcf5
[openbsd] /
1 """
2 Test example snippets from the lldb 'help expression' output.
3 """
4
5
6
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
11
12
13 class Radar9673644TestCase(TestBase):
14
15     mydir = TestBase.compute_mydir(__file__)
16
17     def setUp(self):
18         # Call super's setUp().
19         TestBase.setUp(self)
20         # Find the line number to break inside main().
21         self.main_source = "main.c"
22         self.line = line_number(self.main_source, '// Set breakpoint here.')
23
24     def test_expr_commands(self):
25         """The following expression commands should just work."""
26         self.build()
27
28         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
29
30         lldbutil.run_break_set_by_file_and_line(
31             self,
32             self.main_source,
33             self.line,
34             num_expected_locations=1,
35             loc_exact=True)
36
37         self.runCmd("run", RUN_SUCCEEDED)
38
39         # rdar://problem/9673664 lldb expression evaluation problem
40
41         self.expect('expr char str[] = "foo"; str[0]',
42                     substrs=["'f'"])
43         # runCmd: expr char c[] = "foo"; c[0]
44         # output: (char) $0 = 'f'