]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpointList.h
MFV r337167: 9442 decrease indirect block size of spacemaps
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / common / NativeBreakpointList.h
1 //===-- NativeBreakpointList.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_NativeBreakpointList_h_
11 #define liblldb_NativeBreakpointList_h_
12
13 #include "lldb/Utility/Status.h"
14 #include "lldb/lldb-private-forward.h"
15 // #include "lldb/Host/NativeBreakpoint.h"
16
17 #include <functional>
18 #include <map>
19 #include <mutex>
20
21 namespace lldb_private {
22
23 struct HardwareBreakpoint {
24   lldb::addr_t m_addr;
25   size_t m_size;
26 };
27
28 using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>;
29
30 class NativeBreakpointList {
31 public:
32   typedef std::function<Status(lldb::addr_t addr, size_t size_hint,
33                                bool hardware,
34                                NativeBreakpointSP &breakpoint_sp)>
35       CreateBreakpointFunc;
36
37   NativeBreakpointList();
38
39   Status AddRef(lldb::addr_t addr, size_t size_hint, bool hardware,
40                 CreateBreakpointFunc create_func);
41
42   Status DecRef(lldb::addr_t addr);
43
44   Status EnableBreakpoint(lldb::addr_t addr);
45
46   Status DisableBreakpoint(lldb::addr_t addr);
47
48   Status GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
49
50   Status RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
51
52 private:
53   typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
54
55   std::recursive_mutex m_mutex;
56   BreakpointMap m_breakpoints;
57 };
58 }
59
60 #endif // ifndef liblldb_NativeBreakpointList_h_