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