KPI allows querying of kernel stack trace information and the automated
generation of kernel stack trace strings for the purposes of debugging and
To use the KPI, at least one of
.Cd options DDB
.Cd options STACK
must be compiled into the kernel.
Each stack trace is described by a
.Vt struct stack .
Before a trace may be created or otherwise manipulated, storage for the trace
must be allocated with
which may sleep.
Memory associated with a trace is freed by calling
A trace of the current kernel threads call stack may be captured using
may be used to print a stack trace using the kernel
and may sleep as a result of acquiring
locks in the kernel linker while looking up symbol names.
In locking-sensitive environments, the unsynchronized
variants may be invoked.
This function bypasses kernel linker locking, making it usable in
but not in a live system where linker data structures may change.
may be used to construct a human-readable string, including conversion (where
possible) from a simple kernel instruction pointer to a named symbol and
must be an initialized
as described in
This function may sleep if an auto-extending
is used, or due to kernel linker locking.
In locking-sensitive environments, such as
variant may be invoked to avoid kernel linker locking; it should be used with
a fixed-length sbuf.
The utility functions
may be used to manipulate stack data structures directly.