1""" 2Test lldb-dap setBreakpoints request 3""" 4 5 6import dap_server 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test import lldbutil 10import lldbdap_testcase 11 12 13class TestDAP_setExceptionBreakpoints(lldbdap_testcase.DAPTestCaseBase): 14 @skipIfWindows 15 def test_functionality(self): 16 """Tests setting and clearing exception breakpoints. 17 This packet is a bit tricky on the debug adaptor side since there 18 is no "clear exception breakpoints" packet. Exception breakpoints 19 are set by sending a "setExceptionBreakpoints" packet with zero or 20 more exception filters. If exception breakpoints have been set 21 before, any existing breakpoints must remain set, and any new 22 breakpoints must be created, and any breakpoints that were in 23 previous requests and are not in the current request must be 24 removed. This exception tests this setting and clearing and makes 25 sure things happen correctly. It doesn't test hitting breakpoints 26 and the functionality of each breakpoint, like 'conditions' and 27 x'hitCondition' settings. 28 """ 29 # Visual Studio Code Debug Adaptors have no way to specify the file 30 # without launching or attaching to a process, so we must start a 31 # process in order to be able to set breakpoints. 32 program = self.getBuildArtifact("a.out") 33 self.build_and_launch(program) 34 35 filters = ["cpp_throw", "cpp_catch"] 36 response = self.dap_server.request_setExceptionBreakpoints(filters) 37 if response: 38 self.assertTrue(response["success"]) 39 40 self.continue_to_exception_breakpoint("C++ Throw") 41 self.continue_to_exception_breakpoint("C++ Catch") 42