This class handles segmentation-faults.
More...
#include <CrashHandler.h>
|
typedef void(* | HandlerType) (int) |
| This function type is a pointer to a crash handler function. More...
|
|
typedef void(* | HandlerType) (int) |
| This function type is a pointer to a crash handler function. More...
|
|
This class handles segmentation-faults.
By default it dumps a gdb traceback of the segfaulting application. This default can be overridden by setting a custom crash handler with setCrashHandler(). If a function is specified with setEmergencySaveFunction() it will be called by the default crash handler, giving the application a chance to save its data.
◆ HandlerType [1/2]
typedef void(* Nice::CrashHandler::HandlerType) (int) |
This function type is a pointer to a crash handler function.
The function's argument is the number of the signal.
◆ HandlerType [2/2]
typedef void(* Nice::CrashHandler::HandlerType) (int) |
This function type is a pointer to a crash handler function.
The function's argument is the number of the signal.
◆ crashHandler() [1/2]
static HandlerType Nice::CrashHandler::crashHandler |
( |
| ) |
|
|
inlinestatic |
Returns the installed crash handler.
- Returns
- the crash handler
◆ crashHandler() [2/2]
static HandlerType Nice::CrashHandler::crashHandler |
( |
| ) |
|
|
inlinestatic |
Returns the installed crash handler.
- Returns
- the crash handler
◆ defaultCrashHandler() [1/2]
static void Nice::CrashHandler::defaultCrashHandler |
( |
int |
signal | ) |
|
|
static |
The default crash handler.
- Parameters
-
◆ defaultCrashHandler() [2/2]
void Nice::CrashHandler::defaultCrashHandler |
( |
int |
signal | ) |
|
|
static |
The default crash handler.
- Parameters
-
◆ emergencySaveFunction() [1/2]
static HandlerType Nice::CrashHandler::emergencySaveFunction |
( |
| ) |
|
|
inlinestatic |
Return the currently set emergency save function.
- Returns
- the emergency save function
◆ emergencySaveFunction() [2/2]
static HandlerType Nice::CrashHandler::emergencySaveFunction |
( |
| ) |
|
|
inlinestatic |
Return the currently set emergency save function.
- Returns
- the emergency save function
◆ setApplicationName() [1/2]
static void Nice::CrashHandler::setApplicationName |
( |
const char * |
name | ) |
|
|
inlinestatic |
Sets the application name name
.
- Parameters
-
name | the name of the application |
◆ setApplicationName() [2/2]
static void Nice::CrashHandler::setApplicationName |
( |
const char * |
name | ) |
|
|
inlinestatic |
Sets the application name name
.
- Parameters
-
name | the name of the application |
◆ setApplicationPath() [1/2]
static void Nice::CrashHandler::setApplicationPath |
( |
const char * |
path | ) |
|
|
inlinestatic |
Sets the application path
.
- Parameters
-
path | the application path. |
◆ setApplicationPath() [2/2]
static void Nice::CrashHandler::setApplicationPath |
( |
const char * |
path | ) |
|
|
inlinestatic |
Sets the application path
.
- Parameters
-
path | the application path. |
◆ setCrashHandler() [1/2]
Install a function to be called in case a SIGSEGV is caught.
- Parameters
-
handler | HandlerType handler can be one of
- null in which case signal-catching is disabled (by calling signal(SIGSEGV, SIG_DFL))
- if handler is omitted the default crash handler is installed.
- an user defined function in the form: static (if in a class) void myCrashHandler(int);
|
handler | the crash handler |
◆ setCrashHandler() [2/2]
Install a function to be called in case a SIGSEGV is caught.
- Parameters
-
handler | HandlerType handler can be one of
- null in which case signal-catching is disabled (by calling signal(SIGSEGV, SIG_DFL))
- if handler is omitted the default crash handler is installed.
- an user defined function in the form: static (if in a class) void myCrashHandler(int);
|
handler | the crash handler |
◆ setEmergencySaveFunction() [1/2]
Installs a function which should try to save the applications data.
It is the crash handlers responsibility to call this function. Therefore, if no crash handler is set, the default crash handler is installed to ensure the save function is called.
- Parameters
-
saveFunction | the handler to install |
◆ setEmergencySaveFunction() [2/2]
Installs a function which should try to save the applications data.
It is the crash handlers responsibility to call this function. Therefore, if no crash handler is set, the default crash handler is installed to ensure the save function is called.
- Parameters
-
saveFunction | the handler to install |
◆ _crashHandler
static HandlerType Nice::CrashHandler::_crashHandler = 0 |
|
staticprotected |
Pointer to the crash handler.
◆ _emergencySaveFunction
static HandlerType Nice::CrashHandler::_emergencySaveFunction = 0 |
|
staticprotected |
Pointer to the emergency save function.
◆ appName
static char * Nice::CrashHandler::appName = 0 |
|
staticprivate |
◆ appPath
static char * Nice::CrashHandler::appPath = 0 |
|
staticprivate |
◆ safer
static bool Nice::CrashHandler::safer |
|
staticprivate |
The documentation for this class was generated from the following files: