1""" 2Test stop hooks 3""" 4 5 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8import lldbdap_testcase 9 10 11class TestDAP_stop_hooks(lldbdap_testcase.DAPTestCaseBase): 12 def test_stop_hooks_before_run(self): 13 """ 14 Test that there is no race condition between lldb-dap and 15 stop hooks executor 16 """ 17 program = self.getBuildArtifact("a.out") 18 preRunCommands = ["target stop-hook add -o help"] 19 self.build_and_launch(program, stopOnEntry=True, preRunCommands=preRunCommands) 20 21 # The first stop is on entry. 22 self.continue_to_next_stop() 23 24 breakpoint_ids = self.set_function_breakpoints(["main"]) 25 # This request hangs if the race happens, because, in that case, the 26 # command interpreter is in synchronous mode while lldb-dap expects 27 # it to be in asynchronous mode, so, the process doesn't send the stop 28 # event to "lldb.Debugger" listener (which is monitored by lldb-dap). 29 self.continue_to_breakpoints(breakpoint_ids) 30 31 self.continue_to_exit() 32