12f5cf851SGreg Clayton //===-- SourceBreakpoint.cpp ------------------------------------*- C++ -*-===// 22f5cf851SGreg Clayton // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 62f5cf851SGreg Clayton // 72f5cf851SGreg Clayton //===----------------------------------------------------------------------===// 82f5cf851SGreg Clayton 92f5cf851SGreg Clayton #include "SourceBreakpoint.h" 102f5cf851SGreg Clayton #include "VSCode.h" 112f5cf851SGreg Clayton 122f5cf851SGreg Clayton namespace lldb_vscode { 132f5cf851SGreg Clayton SourceBreakpoint(const llvm::json::Object & obj)142f5cf851SGreg ClaytonSourceBreakpoint::SourceBreakpoint(const llvm::json::Object &obj) 152f5cf851SGreg Clayton : BreakpointBase(obj), line(GetUnsigned(obj, "line", 0)), 162f5cf851SGreg Clayton column(GetUnsigned(obj, "column", 0)) {} 172f5cf851SGreg Clayton SetBreakpoint(const llvm::StringRef source_path)182f5cf851SGreg Claytonvoid SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) { 192f5cf851SGreg Clayton bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line); 209cb227f5SGreg Clayton // See comments in BreakpointBase::GetBreakpointLabel() for details of why 219cb227f5SGreg Clayton // we add a label to our breakpoints. 229cb227f5SGreg Clayton bp.AddName(GetBreakpointLabel()); 232f5cf851SGreg Clayton if (!condition.empty()) 242f5cf851SGreg Clayton SetCondition(); 252f5cf851SGreg Clayton if (!hitCondition.empty()) 262f5cf851SGreg Clayton SetHitCondition(); 27*8c6e138aSJeffrey Tan if (!logMessage.empty()) 28*8c6e138aSJeffrey Tan SetLogMessage(); 292f5cf851SGreg Clayton } 302f5cf851SGreg Clayton 312f5cf851SGreg Clayton } // namespace lldb_vscode 32