00001 #ifndef IGUANA_FRAMEWORK_IG_ON_CRASH_SERVICE_H
00002 # define IGUANA_FRAMEWORK_IG_ON_CRASH_SERVICE_H
00003
00004
00005
00006 # include "Iguana/Framework/interface/config.h"
00007 # include "classlib/utils/Signal.h"
00008 # include <string>
00009
00010
00011
00012
00013
00014
00015
00016
00017 class IGUANA_FRAMEWORK_API IgOnCrashService
00018 {
00019 public:
00020
00021
00022 typedef bool (*FatalSignalHook) (int sig, siginfo_t *info, void *x);
00023 typedef void (*FatalExceptionHook) (const char *type, const char *what);
00024
00025 static bool init (const char *appname);
00026 static FatalSignalHook fatalSignalHook (FatalSignalHook hook);
00027 static FatalExceptionHook fatalExceptionHook (FatalExceptionHook hook);
00028
00029 static const char * fatalTitle (void);
00030 static const char * fatalMessage (void);
00031 static void printFatalMessage (const char *topic,
00032 const char *title,
00033 const char *reason);
00034 static void printFatalException (const char *type,
00035 const char *what);
00036 static void fatalException (const char *type,
00037 const char *what);
00038
00039 private:
00040 IgOnCrashService ();
00041
00042
00043
00044
00045 static bool fatalSignal (int sig, siginfo_t *info, void *x);
00046 static bool defaultFatalSignal (int sig, siginfo_t *info, void *x);
00047 static void defaultFatalException (const char *type,
00048 const char *what);
00049
00050 static void explainException (const char *type,
00051 const char *what,
00052 std::string &topic,
00053 std::string &title,
00054 std::string &reason);
00055
00056 static FatalSignalHook s_signalHook;
00057 static FatalExceptionHook s_exceptionHook;
00058 };
00059
00060
00061
00062
00063 #endif // IGUANA_FRAMEWORK_IG_ON_CRASH_SERVICE_H
00064
00065