1 //===-- SoftwareBreakpoint.h ------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_SoftwareBreakpoint_h_
11 #define liblldb_SoftwareBreakpoint_h_
13 #include "NativeBreakpoint.h"
14 #include "lldb/lldb-private-forward.h"
16 namespace lldb_private {
17 class SoftwareBreakpoint : public NativeBreakpoint {
18 friend class NativeBreakpointList;
21 static Status CreateSoftwareBreakpoint(NativeProcessProtocol &process,
22 lldb::addr_t addr, size_t size_hint,
23 NativeBreakpointSP &breakpoint_spn);
25 SoftwareBreakpoint(NativeProcessProtocol &process, lldb::addr_t addr,
26 const uint8_t *saved_opcodes, const uint8_t *trap_opcodes,
30 Status DoEnable() override;
32 Status DoDisable() override;
34 bool IsSoftwareBreakpoint() const override;
37 /// Max number of bytes that a software trap opcode sequence can occupy.
38 static const size_t MAX_TRAP_OPCODE_SIZE = 8;
40 NativeProcessProtocol &m_process;
41 uint8_t m_saved_opcodes[MAX_TRAP_OPCODE_SIZE];
42 uint8_t m_trap_opcodes[MAX_TRAP_OPCODE_SIZE];
43 const size_t m_opcode_size;
45 static Status EnableSoftwareBreakpoint(NativeProcessProtocol &process,
47 size_t bp_opcode_size,
48 const uint8_t *bp_opcode_bytes,
49 uint8_t *saved_opcode_bytes);
53 #endif // #ifndef liblldb_SoftwareBreakpoint_h_