]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/common/SoftwareBreakpoint.h
MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / common / SoftwareBreakpoint.h
1 //===-- SoftwareBreakpoint.h ------------------------------------*- 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 #ifndef liblldb_SoftwareBreakpoint_h_
11 #define liblldb_SoftwareBreakpoint_h_
12
13 #include "NativeBreakpoint.h"
14 #include "lldb/lldb-private-forward.h"
15
16 namespace lldb_private {
17 class SoftwareBreakpoint : public NativeBreakpoint {
18   friend class NativeBreakpointList;
19
20 public:
21   static Status CreateSoftwareBreakpoint(NativeProcessProtocol &process,
22                                          lldb::addr_t addr, size_t size_hint,
23                                          NativeBreakpointSP &breakpoint_spn);
24
25   SoftwareBreakpoint(NativeProcessProtocol &process, lldb::addr_t addr,
26                      const uint8_t *saved_opcodes, const uint8_t *trap_opcodes,
27                      size_t opcode_size);
28
29 protected:
30   Status DoEnable() override;
31
32   Status DoDisable() override;
33
34   bool IsSoftwareBreakpoint() const override;
35
36 private:
37   /// Max number of bytes that a software trap opcode sequence can occupy.
38   static const size_t MAX_TRAP_OPCODE_SIZE = 8;
39
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;
44
45   static Status EnableSoftwareBreakpoint(NativeProcessProtocol &process,
46                                          lldb::addr_t addr,
47                                          size_t bp_opcode_size,
48                                          const uint8_t *bp_opcode_bytes,
49                                          uint8_t *saved_opcode_bytes);
50 };
51 }
52
53 #endif // #ifndef liblldb_SoftwareBreakpoint_h_