32 lines · cpp
1//===-- TestGetTargetBreakpointsRequestHandler.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-exception6//7//===----------------------------------------------------------------------===//8 9#include "DAP.h"10#include "EventHelper.h"11#include "JSONUtils.h"12#include "RequestHandler.h"13 14namespace lldb_dap {15 16void TestGetTargetBreakpointsRequestHandler::operator()(17 const llvm::json::Object &request) const {18 llvm::json::Object response;19 FillResponse(request, response);20 llvm::json::Array response_breakpoints;21 for (uint32_t i = 0; dap.target.GetBreakpointAtIndex(i).IsValid(); ++i) {22 auto bp = Breakpoint(dap, dap.target.GetBreakpointAtIndex(i));23 response_breakpoints.push_back(bp.ToProtocolBreakpoint());24 }25 llvm::json::Object body;26 body.try_emplace("breakpoints", std::move(response_breakpoints));27 response.try_emplace("body", std::move(body));28 dap.SendJSON(llvm::json::Value(std::move(response)));29}30 31} // namespace lldb_dap32