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 "lldb/API/SBBreakpoint.h"
13#include "lldb/API/SBTarget.h"
14#include "llvm/ADT/StringRef.h"
15
16namespace lldb_dap {
17
18InstructionBreakpoint::InstructionBreakpoint(
19 DAP &d, const protocol::InstructionBreakpoint &breakpoint)
20 : Breakpoint(d, breakpoint.condition, breakpoint.hitCondition),
21 m_instruction_address_reference(LLDB_INVALID_ADDRESS),
22 m_offset(breakpoint.offset.value_or(u: 0)) {
23 llvm::StringRef instruction_reference(breakpoint.instructionReference);
24 instruction_reference.getAsInteger(Radix: 0, Result&: m_instruction_address_reference);
25 m_instruction_address_reference += m_offset;
26}
27
28void InstructionBreakpoint::SetBreakpoint() {
29 m_bp =
30 m_dap.target.BreakpointCreateByAddress(address: m_instruction_address_reference);
31 Breakpoint::SetBreakpoint();
32}
33
34} // namespace lldb_dap
35

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of lldb/tools/lldb-dap/InstructionBreakpoint.cpp