]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Host/common/SoftwareBreakpoint.h
Merge ^/head r274961 through r276342.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / 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 "lldb/lldb-private-forward.h"
14 #include "NativeBreakpoint.h"
15
16 namespace lldb_private
17 {
18     class SoftwareBreakpoint : public NativeBreakpoint
19     {
20     public:
21         static Error
22         CreateSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_spn);
23
24         SoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, const uint8_t *saved_opcodes, const uint8_t *trap_opcodes, size_t opcode_size);
25
26     protected:
27         Error
28         DoEnable () override;
29
30         Error
31         DoDisable () override;
32
33         bool
34         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 Error
46         EnableSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t bp_opcode_size, const uint8_t *bp_opcode_bytes, uint8_t *saved_opcode_bytes);
47
48     };
49 }
50
51 #endif // #ifndef liblldb_SoftwareBreakpoint_h_