xref: /NextBSD/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpoint.h (revision 84d351007654069f9643c8e4b4802a7f5f08ee42)
1 //===-- NativeBreakpoint.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_NativeBreakpoint_h_
11 #define liblldb_NativeBreakpoint_h_
12 
13 #include "lldb/lldb-types.h"
14 
15 namespace lldb_private
16 {
17     class NativeBreakpointList;
18 
19     class NativeBreakpoint
20     {
21         friend class NativeBreakpointList;
22 
23     public:
24         // The assumption is that derived breakpoints are enabled when created.
25         NativeBreakpoint (lldb::addr_t addr);
26 
27         virtual
28         ~NativeBreakpoint ();
29 
30         Error
31         Enable ();
32 
33         Error
34         Disable ();
35 
36         lldb::addr_t
GetAddress()37         GetAddress () const { return m_addr; }
38 
39         bool
IsEnabled()40         IsEnabled () const { return m_enabled; }
41 
42         virtual bool
43         IsSoftwareBreakpoint () const = 0;
44 
45     protected:
46         const lldb::addr_t m_addr;
47         int32_t m_ref_count;
48 
49         virtual Error
50         DoEnable () = 0;
51 
52         virtual Error
53         DoDisable () = 0;
54 
55     private:
56         bool m_enabled;
57 
58         // -----------------------------------------------------------
59         // interface for NativeBreakpointList
60         // -----------------------------------------------------------
61         void AddRef ();
62         int32_t DecRef ();
63     };
64 }
65 
66 #endif // ifndef liblldb_NativeBreakpoint_h_
67