brintos

brintos / llvm-project-archived public Read only

0
0
Text · 895 B · a09c4a7 Raw
31 lines · python
1import lldb2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5 6 7class CommandOverrideCallback(TestBase):8    def setUp(self):9        TestBase.setUp(self)10        self.line = line_number("main.c", "Hello world.")11 12    def test_command_override_callback(self):13        self.build()14        exe = self.getBuildArtifact("a.out")15 16        target = self.dbg.CreateTarget(exe)17        self.assertTrue(target, VALID_TARGET)18 19        ci = self.dbg.GetCommandInterpreter()20        self.assertTrue(ci, VALID_COMMAND_INTERPRETER)21 22        command_arg = ""23 24        def foo(*command_args):25            nonlocal command_arg26            command_arg = command_args[0]27 28        self.assertTrue(ci.SetCommandOverrideCallback("breakpoint set", foo))29        self.expect("breakpoint set -n main")30        self.assertTrue(command_arg == "breakpoint")31