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