1 //===-- InstructionBreakpoint.cpp ------------------------------------*- C++ 2 //-*-===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "InstructionBreakpoint.h" 11 #include "DAP.h" 12 #include "JSONUtils.h" 13 #include "lldb/API/SBBreakpoint.h" 14 #include "lldb/API/SBTarget.h" 15 #include "llvm/ADT/StringRef.h" 16 17 namespace lldb_dap { 18 19 // Instruction Breakpoint 20 InstructionBreakpoint::InstructionBreakpoint(DAP &d, 21 const llvm::json::Object &obj) 22 : Breakpoint(d, obj), instructionAddressReference(LLDB_INVALID_ADDRESS), 23 offset(GetSigned(obj, "offset", 0)) { 24 GetString(obj, "instructionReference") 25 .getAsInteger(0, instructionAddressReference); 26 instructionAddressReference += offset; 27 } 28 29 void InstructionBreakpoint::SetBreakpoint() { 30 bp = dap.target.BreakpointCreateByAddress(instructionAddressReference); 31 Breakpoint::SetBreakpoint(); 32 } 33 34 } // namespace lldb_dap 35