xref: /NextBSD/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX.h (revision 287e3b14e9552995def1802ec9c5034f4adf28ec)
1 //===-- RegisterContextPOSIX.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_RegisterContextPOSIX_H_
11 #define liblldb_RegisterContextPOSIX_H_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 #include "lldb/Core/ArchSpec.h"
17 #include "lldb/Target/RegisterContext.h"
18 #include "RegisterInfoInterface.h"
19 
20 //------------------------------------------------------------------------------
21 /// @class POSIXBreakpointProtocol
22 ///
23 /// @brief Extends RegisterClass with a few virtual operations useful on POSIX.
24 class POSIXBreakpointProtocol
25 {
26 public:
POSIXBreakpointProtocol()27     POSIXBreakpointProtocol()
28         { m_watchpoints_initialized = false; }
~POSIXBreakpointProtocol()29     virtual ~POSIXBreakpointProtocol() {}
30 
31     /// Updates the register state of the associated thread after hitting a
32     /// breakpoint (if that make sense for the architecture).  Default
33     /// implementation simply returns true for architectures which do not
34     /// require any update.
35     ///
36     /// @return
37     ///    True if the operation succeeded and false otherwise.
38     virtual bool UpdateAfterBreakpoint() = 0;
39 
40     /// Determines the index in lldb's register file given a kernel byte offset.
41     virtual unsigned
42     GetRegisterIndexFromOffset(unsigned offset) = 0;
43 
44     // Checks to see if a watchpoint specified by hw_index caused the inferior
45     // to stop.
46     virtual bool
47     IsWatchpointHit (uint32_t hw_index) = 0;
48 
49     // Resets any watchpoints that have been hit.
50     virtual bool
51     ClearWatchpointHits () = 0;
52 
53     // Returns the watchpoint address associated with a watchpoint hardware
54     // index.
55     virtual lldb::addr_t
56     GetWatchpointAddress (uint32_t hw_index) = 0;
57 
58     virtual bool
59     IsWatchpointVacant (uint32_t hw_index) = 0;
60 
61     virtual bool
62     SetHardwareWatchpointWithIndex (lldb::addr_t addr, size_t size,
63                                     bool read, bool write,
64                                     uint32_t hw_index) = 0;
65 
66     // From lldb_private::RegisterContext
67     virtual uint32_t
68     NumSupportedHardwareWatchpoints () = 0;
69 
70     // Force m_watchpoints_initialized to TRUE
71     void
ForceWatchpointsInitialized()72     ForceWatchpointsInitialized () {m_watchpoints_initialized = true;}
73 
74 protected:
75     bool m_watchpoints_initialized;
76 };
77 
78 #endif // #ifndef liblldb_RegisterContextPOSIX_H_
79 
80