#ifndef _HW_BREAKPOINT_H_ #define _HW_BREAKPOINT_H_ #ifdef _DEBUG enum Condition { W = 1, RW = 3 } ; class HwBreakpoint { public: HwBreakpoint() { m_index = -1; } ~HwBreakpoint() { Clear(); } // The enum values correspond to the values used by the Intel Pentium, // so don't change them! void BrkOn(void* address, int len /* 1, 2, or 4 */, Condition when); void Clear(); protected: inline void SetBits(unsigned long& dw, int lowBit, int bits, int newValue) { int mask = (1 << bits) - 1; // e.g. 1 becomes 0001, 2 becomes 0011, 3 becomes 0111 dw = (dw & ~(mask << lowBit)) | (newValue << lowBit); } int m_index; // -1 means not set; 0-3 means we've set that hardware bp }; #endif // _DEBUG #endif // _HW_BREAKPOINT_H_