Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/stack.9
Show All 21 Lines | |||||
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||||
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
.\" DAMAGE. | .\" DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd September 10, 2015 | .Dd October 6, 2017 | ||||
.Dt STACK 9 | .Dt STACK 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm stack | .Nm stack | ||||
.Nd kernel thread stack tracing routines | .Nd kernel thread stack tracing routines | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/param.h | .In sys/param.h | ||||
.In sys/stack.h | .In sys/stack.h | ||||
.Pp | .Pp | ||||
In the kernel configuration file: | In the kernel configuration file: | ||||
.Cd "options DDB" | .Cd "options DDB" | ||||
.Cd "options STACK" | .Cd "options STACK" | ||||
.Pp | .Pp | ||||
.Ft struct stack * | .Ft struct stack * | ||||
.Fn stack_create "void" | .Fn stack_create "int flags" | ||||
.Ft void | .Ft void | ||||
.Fn stack_destroy "struct stack *st" | .Fn stack_destroy "struct stack *st" | ||||
.Ft int | .Ft int | ||||
.Fn stack_put "struct stack *st" "vm_offset_t pc" | .Fn stack_put "struct stack *st" "vm_offset_t pc" | ||||
.Ft void | .Ft void | ||||
.Fn stack_copy "const struct stack *src" "struct stack dst" | .Fn stack_copy "const struct stack *src" "struct stack dst" | ||||
.Ft void | .Ft void | ||||
.Fn stack_zero "struct stack *st" | .Fn stack_zero "struct stack *st" | ||||
Show All 26 Lines | |||||
and | and | ||||
.Cd "options STACK" | .Cd "options STACK" | ||||
must be compiled into the kernel. | must be compiled into the kernel. | ||||
.Pp | .Pp | ||||
Each stack trace is described by a | Each stack trace is described by a | ||||
.Vt "struct stack" . | .Vt "struct stack" . | ||||
Before a trace may be created or otherwise manipulated, storage for the trace | Before a trace may be created or otherwise manipulated, storage for the trace | ||||
must be allocated with | must be allocated with | ||||
.Fn stack_create , | .Fn stack_create . | ||||
which may sleep. | The | ||||
.Ar flags | |||||
argument is passed to | |||||
.Xr malloc 9 . | |||||
Memory associated with a trace is freed by calling | Memory associated with a trace is freed by calling | ||||
.Fn stack_destroy . | .Fn stack_destroy . | ||||
.Pp | .Pp | ||||
A trace of the current kernel thread's call stack may be captured using | A trace of the current kernel thread's call stack may be captured using | ||||
.Fn stack_save . | .Fn stack_save . | ||||
.Fn stack_save_td | .Fn stack_save_td | ||||
and | and | ||||
.Fn stack_save_td_running | .Fn stack_save_td_running | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |