Changeset 7449 for code/trunk/src/libraries/util/SignalHandler.h
- Timestamp:
- Sep 13, 2010, 11:12:21 PM (15 years ago)
- File:
-
- 1 edited
-
code/trunk/src/libraries/util/SignalHandler.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/SignalHandler.h
r7401 r7449 39 39 40 40 #include <cassert> 41 #include <list>42 41 #include <string> 43 42 #include "Singleton.h" 43 #include "SpecialConfig.h" 44 44 45 45 namespace orxonox … … 48 48 } 49 49 50 #ifdef ORXONOX_PLATFORM_LINUX 50 #if defined(ORXONOX_PLATFORM_LINUX) 51 52 #include <list> 51 53 #include <signal.h> 52 54 … … 97 99 } 98 100 99 #else /* ORXONOX_PLATFORM_LINUX */ 101 #elif defined(ORXONOX_PLATFORM_WINDOWS) && defined(DBGHELP_FOUND) 102 103 #include <windows.h> 100 104 101 105 namespace orxonox 102 106 { 103 /// The SignalHandler is used to catch signals like SIGSEGV and write a backtrace to the logfile. Not implemented on Windows.107 /// The SignalHandler is used to catch unhandled exceptions like access violations and write a backtrace to the logfile. 104 108 class _UtilExport SignalHandler : public Singleton<SignalHandler> 105 109 { 106 110 friend class Singleton<SignalHandler>; 107 111 public: 108 SignalHandler() { } 109 ~SignalHandler() { } 112 SignalHandler(); 113 ~SignalHandler(); 114 115 void doCatch( const std::string & appName, const std::string & filename ); 116 117 private: 118 static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS pExceptionInfo); 119 120 static std::string getStackTrace(PEXCEPTION_POINTERS pExceptionInfo = NULL); 121 static std::string getExceptionType(PEXCEPTION_POINTERS pExceptionInfo); 122 static std::string getModuleName(const std::string& path); 123 static DWORD getModuleBase(DWORD dwAddress); 124 125 template <typename T> 126 static std::string pointerToString(T pointer); 127 template <typename T> 128 static std::string pointerToString(T* pointer); 129 130 static SignalHandler* singletonPtr_s; 131 132 std::string filename_; 133 LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter_; 134 }; 135 } 136 137 #else 138 139 namespace orxonox 140 { 141 /// The SignalHandler is used to catch signals like SIGSEGV and write a backtrace to the logfile. Not implemented on systems except Linux and Windows. 142 class _UtilExport SignalHandler : public Singleton<SignalHandler> 143 { 144 friend class Singleton<SignalHandler>; 145 public: 110 146 void doCatch( const std::string & appName, const std::string & filename ) {} 111 void dontCatch() {}112 void registerCallback( SignalCallback cb, void * someData ) {}113 147 114 148 private: … … 117 151 } 118 152 119 #endif /* ORXONOX_PLATFORM_LINUX */153 #endif 120 154 121 155 #endif /* _SignalHandler_H__ */
Note: See TracChangeset
for help on using the changeset viewer.










