xref: /openbsd-src/gnu/llvm/lldb/tools/lldb-vscode/SourceBreakpoint.cpp (revision 061da546b983eb767bad15e67af1174fb0bcf31c)
1*061da546Spatrick //===-- SourceBreakpoint.cpp ------------------------------------*- C++ -*-===//
2*061da546Spatrick //
3*061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*061da546Spatrick //
7*061da546Spatrick //===----------------------------------------------------------------------===//
8*061da546Spatrick 
9*061da546Spatrick #include "SourceBreakpoint.h"
10*061da546Spatrick #include "VSCode.h"
11*061da546Spatrick 
12*061da546Spatrick namespace lldb_vscode {
13*061da546Spatrick 
14*061da546Spatrick SourceBreakpoint::SourceBreakpoint(const llvm::json::Object &obj)
15*061da546Spatrick     : BreakpointBase(obj), line(GetUnsigned(obj, "line", 0)),
16*061da546Spatrick       column(GetUnsigned(obj, "column", 0)) {}
17*061da546Spatrick 
18*061da546Spatrick void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
19*061da546Spatrick   bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line);
20*061da546Spatrick   if (!condition.empty())
21*061da546Spatrick     SetCondition();
22*061da546Spatrick   if (!hitCondition.empty())
23*061da546Spatrick     SetHitCondition();
24*061da546Spatrick }
25*061da546Spatrick 
26*061da546Spatrick } // namespace lldb_vscode
27