1061da546Spatrick //===-- SourceBreakpoint.cpp ------------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9061da546Spatrick #include "SourceBreakpoint.h" 10061da546Spatrick #include "VSCode.h" 11061da546Spatrick 12061da546Spatrick namespace lldb_vscode { 13061da546Spatrick SourceBreakpoint(const llvm::json::Object & obj)14061da546SpatrickSourceBreakpoint::SourceBreakpoint(const llvm::json::Object &obj) 15061da546Spatrick : BreakpointBase(obj), line(GetUnsigned(obj, "line", 0)), 16061da546Spatrick column(GetUnsigned(obj, "column", 0)) {} 17061da546Spatrick SetBreakpoint(const llvm::StringRef source_path)18061da546Spatrickvoid SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) { 19061da546Spatrick bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line); 20dda28197Spatrick // See comments in BreakpointBase::GetBreakpointLabel() for details of why 21dda28197Spatrick // we add a label to our breakpoints. 22dda28197Spatrick bp.AddName(GetBreakpointLabel()); 23061da546Spatrick if (!condition.empty()) 24061da546Spatrick SetCondition(); 25061da546Spatrick if (!hitCondition.empty()) 26061da546Spatrick SetHitCondition(); 27*f6aab3d8Srobert if (!logMessage.empty()) 28*f6aab3d8Srobert SetLogMessage(); 29061da546Spatrick } 30061da546Spatrick 31061da546Spatrick } // namespace lldb_vscode 32