00001
00002 #ifndef CXXUTILS_PTRACCESSSEGVHANDLER_H
00003 #define CXXUTILS_PTRACCESSSEGVHANDLER_H 1
00004
00018 #include <signal.h>
00019 #include <vector>
00020
00021 class PageAccessControl;
00022
00023 class PtrAccessSEGVHandler {
00024 public:
00026 typedef std::vector<void*> accessed_t;
00027 typedef accessed_t::const_iterator const_iterator;
00028 const accessed_t& accessedPtrs() const { return m_accessed; }
00029 const_iterator beginAccessedPtrs() const { return m_accessed.begin(); }
00030 const_iterator endAccessedPtrs() const { return m_accessed.end(); }
00031 void reset() { m_accessed.clear(); }
00032
00033 PtrAccessSEGVHandler(PageAccessControl& pac, size_t reservedSize=65535) :
00034 m_pac(pac)
00035 {
00036
00037 m_accessed.reserve(reservedSize);
00038 }
00039
00041 void handle(int signal_number,siginfo_t *sigi,void *unused);
00042
00043 private:
00045 PageAccessControl& m_pac;
00047 accessed_t m_accessed;
00048 };
00049 #endif