1 //===-- BreakpointBase.cpp --------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "BreakpointBase.h" 11 #include "llvm/ADT/StringExtras.h" 12 13 using namespace lldb_vscode; 14 15 BreakpointBase::BreakpointBase(const llvm::json::Object &obj) 16 : condition(GetString(obj, "condition")), 17 hitCondition(GetString(obj, "hitCondition")), 18 logMessage(GetString(obj, "logMessage")) {} 19 20 void BreakpointBase::SetCondition() { bp.SetCondition(condition.c_str()); } 21 22 void BreakpointBase::SetHitCondition() { 23 uint64_t hitCount = 0; 24 if (llvm::to_integer(hitCondition, hitCount)) 25 bp.SetIgnoreCount(hitCount - 1); 26 } 27 28 void BreakpointBase::UpdateBreakpoint(const BreakpointBase &request_bp) { 29 if (condition != request_bp.condition) { 30 condition = request_bp.condition; 31 SetCondition(); 32 } 33 if (hitCondition != request_bp.hitCondition) { 34 hitCondition = request_bp.hitCondition; 35 SetHitCondition(); 36 } 37 } 38