brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 5f41b93 Raw
37 lines · python
1"""2Test example snippets from the lldb 'help expression' output.3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class Radar9673644TestCase(TestBase):13    def setUp(self):14        # Call super's setUp().15        TestBase.setUp(self)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.")19 20    def test_expr_commands(self):21        """The following expression commands should just work."""22        self.build()23 24        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)25 26        lldbutil.run_break_set_by_file_and_line(27            self, self.main_source, self.line, num_expected_locations=1, loc_exact=True28        )29 30        self.runCmd("run", RUN_SUCCEEDED)31 32        # rdar://problem/9673664 lldb expression evaluation problem33 34        self.expect('expr char str[] = "foo"; str[0]', substrs=["'f'"])35        # runCmd: expr char c[] = "foo"; c[0]36        # output: (char) $0 = 'f'37