aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
blob: 5d336af740c999c4806c631b0b69d3d936f4023a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//===-- SetBreakpointsRequestHandler.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "DAP.h"
#include "Protocol/ProtocolRequests.h"
#include "RequestHandler.h"
#include <vector>

namespace lldb_dap {

/// Sets multiple breakpoints for a single source and clears all previous
/// breakpoints in that source. To clear all breakpoint for a source, specify an
/// empty array. When a breakpoint is hit, a `stopped` event (with reason
/// `breakpoint`) is generated.
llvm::Expected<protocol::SetBreakpointsResponseBody>
SetBreakpointsRequestHandler::Run(
    const protocol::SetBreakpointsArguments &args) const {
  std::vector<protocol::Breakpoint> response_breakpoints =
      dap.SetSourceBreakpoints(args.source, args.breakpoints);
  return protocol::SetBreakpointsResponseBody{std::move(response_breakpoints)};
}

} // namespace lldb_dap