27 lines · python
1"""2Test stop hooks3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7import lldbdap_testcase8 9 10class TestDAP_stop_hooks(lldbdap_testcase.DAPTestCaseBase):11 def test_stop_hooks_before_run(self):12 """13 Test that there is no race condition between lldb-dap and14 stop hooks executor15 """16 program = self.getBuildArtifact("a.out")17 preRunCommands = ["target stop-hook add -o help"]18 self.build_and_launch(program, preRunCommands=preRunCommands)19 breakpoint_ids = self.set_function_breakpoints(["main"])20 # This request hangs if the race happens, because, in that case, the21 # command interpreter is in synchronous mode while lldb-dap expects22 # it to be in asynchronous mode, so, the process doesn't send the stop23 # event to "lldb.Debugger" listener (which is monitored by lldb-dap).24 self.continue_to_breakpoints(breakpoint_ids)25 26 self.continue_to_exit()27