STX
1.0.0
|
Classes | |
struct | CharSpan |
Mutable type-erased view over a contiguous character container. More... | |
struct | Frame |
reperesents an active stack frame. More... | |
struct | Symbol |
Typedefs | |
using | Callback = bool(*)(Frame, int) |
Enumerations | |
enum | SignalError { SignalError::Unknown, SignalError::SigErr } |
Functions | |
SpanReport | operator>> (ReportQuery, SignalError const &err) noexcept |
int | trace (Callback callback, int skip_count=0) |
auto | handle_signal (int signal) noexcept -> Result< void(*)(int), SignalError > |
using stx::backtrace::Callback = typedef bool (*)(Frame, int) |
|
strong |
|
noexcept |
Installs an handler for the specified signal that prints a backtrace whenever the signal is raised. It can and will only handle SIGSEGV
, SIGILL
, and SIGFPE
. It returns the previous signal handler if successful, else returns the error.
|
inlinenoexcept |
int stx::backtrace::trace | ( | Callback | callback, |
int | skip_count = 0 |
||
) |
Gets a backtrace within the current machine's state. This function walks down the stack, and calls callback on each stack frame as it does so. if the callback invocation's result evaluates to true, it stops which means it has found the desired stack frame, else, it keeps walking the stack until it exhausts the stack frame / reaches the maximum stack depth. This function does not perform stack-unwinding.
Returns the number of stack frames read.
callback
is allowed to throw exceptions.
Do not move the frame nor its member objects out of the callback, nor bind a reference to them.
The function is non-panicking as long as the callback doesn't panic. The callback can throw an exception.