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