12345678910111213141516171819202122 |
- #ifndef __DEBUG_H
- #define __DEBUG_H
- class Debug
- {
- public:
- static const char *GetFileName();
- static int GetLineNumber();
- static void SetFileAndLine(const char *file,int lineNumber);
- // Linux uses signals to
- // Display an error from a segmentation fault.
- static void ErrorHandler(int signum);
- // Add error handlers for segmenation faults not caught with try/catch.
- static void AddErrorHandler();
- // Make sure the signals don't point to some function that might not exist in the future.
- static void RemoveErrorHandler();
- };
- // Turn this on to debug segmentation faults:
- #define DEBUG Debug::SetFileAndLine(__FILE__,__LINE__)
- #endif
|