| 1 | //===-- SetBreakpointsRequestHandler.cpp ----------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "DAP.h" |
| 10 | #include "Protocol/ProtocolRequests.h" |
| 11 | #include "RequestHandler.h" |
| 12 | #include <vector> |
| 13 | |
| 14 | namespace lldb_dap { |
| 15 | |
| 16 | /// Sets multiple breakpoints for a single source and clears all previous |
| 17 | /// breakpoints in that source. To clear all breakpoint for a source, specify an |
| 18 | /// empty array. When a breakpoint is hit, a `stopped` event (with reason |
| 19 | /// `breakpoint`) is generated. |
| 20 | llvm::Expected<protocol::SetBreakpointsResponseBody> |
| 21 | SetBreakpointsRequestHandler::Run( |
| 22 | const protocol::SetBreakpointsArguments &args) const { |
| 23 | std::vector<protocol::Breakpoint> response_breakpoints = |
| 24 | dap.SetSourceBreakpoints(source: args.source, breakpoints: args.breakpoints); |
| 25 | return protocol::SetBreakpointsResponseBody{.breakpoints: std::move(response_breakpoints)}; |
| 26 | } |
| 27 | |
| 28 | } // namespace lldb_dap |
| 29 |
