KCrash 5.109.0
|
This namespace contains functions to handle crashes. More...
Typedefs | |
typedef QFlags< CrashFlag > | CrashFlags |
Stores a combination of #CrashFlag values. | |
typedef void(* | HandlerType) (int) |
Typedef for a pointer to a crash handler function. | |
Enumerations | |
enum | CrashFlag { KeepFDs = 1 , SaferDialog = 2 , AlwaysDirectly , AutoRestart = 8 } |
Options to determine how the default crash handler should behave. More... | |
Functions | |
HandlerType | crashHandler () |
Returns the installed crash handler. | |
void | defaultCrashHandler (int signal) |
The default crash handler. | |
HandlerType | emergencySaveFunction () |
Returns the currently set emergency save function. | |
void | initialize () |
Initialize KCrash. | |
bool | isDrKonqiEnabled () |
Returns true if DrKonqi is set to be launched from the crash handler or false otherwise. | |
void | setCrashHandler (HandlerType handler=defaultCrashHandler) |
Install a function to be called when a crash occurs. | |
void | setDrKonqiEnabled (bool enabled) |
Enables or disables launching DrKonqi from the crash handler. | |
void | setEmergencySaveFunction (HandlerType saveFunction=nullptr) |
Installs a function which should try to save the application's data. | |
void | setErrorMessage (const QString &message) |
Allows providing information to be included in the bug report. | |
void | setFlags (KCrash::CrashFlags flags) |
Set options to determine how the default crash handler should behave. | |
This namespace contains functions to handle crashes.
It allows you to set a crash handler function that will be called when your application crashes and also provides a default crash handler that implements the following functionality:
typedef QFlags< CrashFlag > KCrash::CrashFlags |
Stores a combination of #CrashFlag values.
typedef void(* KCrash::HandlerType) (int) |
Typedef for a pointer to a crash handler function.
The function's argument is the number of the signal.
enum KCrash::CrashFlag |
Options to determine how the default crash handler should behave.
Enumerator | |
---|---|
KeepFDs | don't close all file descriptors immediately |
SaferDialog | start DrKonqi without arbitrary disk access |
AlwaysDirectly | never try to to start DrKonqi via kdeinit. Use fork() and exec() instead.
|
AutoRestart | autorestart this application. Only sensible for KUniqueApplications.
|
HandlerType KCrash::crashHandler | ( | ) |
Returns the installed crash handler.
void KCrash::defaultCrashHandler | ( | int | signal | ) |
The default crash handler.
Do not call this function directly. Instead, use setCrashHandler() to set it as your application's crash handler.
signal | the signal number |
HandlerType KCrash::emergencySaveFunction | ( | ) |
Returns the currently set emergency save function.
void KCrash::initialize | ( | ) |
Initialize KCrash.
This does nothing if $KDE_DEBUG is set.
Call this in your main() to ensure that the crash handler is always launched.
bool KCrash::isDrKonqiEnabled | ( | ) |
Returns true if DrKonqi is set to be launched from the crash handler or false otherwise.
void KCrash::setCrashHandler | ( | HandlerType | handler = defaultCrashHandler | ) |
Install a function to be called when a crash occurs.
A crash occurs when one of the following signals is caught: SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT.
handler | this can be one of:
|
void KCrash::setDrKonqiEnabled | ( | bool | enabled | ) |
Enables or disables launching DrKonqi from the crash handler.
By default, launching DrKonqi is enabled when QCoreApplication is created. To disable it:
void KCrash::setEmergencySaveFunction | ( | HandlerType | saveFunction = nullptr | ) |
Installs a function which should try to save the application's data.
saveFunction | the handler to install |
void KCrash::setErrorMessage | ( | const QString & | message | ) |
Allows providing information to be included in the bug report.
void KCrash::setFlags | ( | KCrash::CrashFlags | flags | ) |
Set options to determine how the default crash handler should behave.
flags | ORed together CrashFlags |