2 Test example snippets from the lldb 'help expression' output.
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 class Radar9673644TestCase(TestBase
):
14 # Call super's setUp().
16 # Find the line number to break inside main().
17 self
.main_source
= "main.c"
18 self
.line
= line_number(self
.main_source
, "// Set breakpoint here.")
20 def test_expr_commands(self
):
21 """The following expression commands should just work."""
24 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
26 lldbutil
.run_break_set_by_file_and_line(
27 self
, self
.main_source
, self
.line
, num_expected_locations
=1, loc_exact
=True
30 self
.runCmd("run", RUN_SUCCEEDED
)
32 # rdar://problem/9673664 lldb expression evaluation problem
34 self
.expect('expr char str[] = "foo"; str[0]', substrs
=["'f'"])
35 # runCmd: expr char c[] = "foo"; c[0]
36 # output: (char) $0 = 'f'