40 lines · python
1"""2Test lldb-dap setExceptionBreakpoints request3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7import lldbdap_testcase8 9 10class TestDAP_setExceptionBreakpoints(lldbdap_testcase.DAPTestCaseBase):11 @skipIfWindows12 def test_functionality(self):13 """Tests setting and clearing exception breakpoints.14 This packet is a bit tricky on the debug adapter side since there15 is no "clear exception breakpoints" packet. Exception breakpoints16 are set by sending a "setExceptionBreakpoints" packet with zero or17 more exception filters. If exception breakpoints have been set18 before, any existing breakpoints must remain set, and any new19 breakpoints must be created, and any breakpoints that were in20 previous requests and are not in the current request must be21 removed. This exception tests this setting and clearing and makes22 sure things happen correctly. It doesn't test hitting breakpoints23 and the functionality of each breakpoint, like 'conditions' and24 x'hitCondition' settings.25 """26 # Visual Studio Code Debug Adapters have no way to specify the file27 # without launching or attaching to a process, so we must start a28 # process in order to be able to set breakpoints.29 program = self.getBuildArtifact("a.out")30 self.build_and_launch(program)31 32 response = self.dap_server.request_setExceptionBreakpoints(33 filters=["cpp_throw", "cpp_catch"],34 )35 if response:36 self.assertTrue(response["success"])37 38 self.continue_to_exception_breakpoint("C++ Throw")39 self.continue_to_exception_breakpoint("C++ Catch")40