Configuration options for absl::InstallFailureSignalHandler().

Synopsis

Declared in <absl/debugging/failure_signal_handler.h>

struct FailureSignalHandlerOptions;

Data Members

Name

Description

alarm_on_failure_secs

If positive, indicates the number of seconds after which the failure signal handler is invoked to abort the program. Setting such an alarm is useful in cases where the failure signal handler itself may become hung or deadlocked.

call_previous_handler

If true, call the previously registered signal handler for the signal that was received (if one was registered) after the existing signal handler runs. This mechanism can be used to chain signal handlers together.

symbolize_stacktrace

If true, try to symbolize the stacktrace emitted on failure, provided that you have initialized a symbolizer for that purpose. (See symbolize.h for more information.)

use_alternate_stack

If true, try to run signal handlers on an alternate stack (if supported on the given platform). An alternate stack is useful for program crashes due to a stack overflow; by running on a alternate stack, the signal handler may run even when normal stack space has been exhausted. The downside of using an alternate stack is that extra memory for the alternate stack needs to be pre‐allocated.

writerfn

If non‐null, indicates a pointer to a callback function that will be called upon failure, with a string argument containing failure data. This function may be used as a hook to write failure data to a secondary location, such as a log file. This function will also be called with null data, as a hint to flush any buffered data before the program may be terminated. Consider flushing any buffered data in all calls to this function.

Non-Member Functions

Name

Description

InstallFailureSignalHandler

Installs a signal handler for the common failure signals SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGTERM, SIGBUG, and SIGTRAP (provided they exist on the given platform). The failure signal handler dumps program failure data useful for debugging in an unspecified format to stderr. This data may include the program counter, a stacktrace, and register information on some systems; do not rely on an exact format for the output, as it is subject to change.

Created with MrDocs