Index: share/man/man9/stack.9 =================================================================== --- share/man/man9/stack.9 +++ share/man/man9/stack.9 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2020 +.Dd March 6, 2022 .Dt STACK 9 .Os .Sh NAME @@ -82,20 +82,31 @@ 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 +must be allocated. +This is usually done by declaring an instance of +.Vt "struct stack" +and initializing it with one of +.Fn stack_save , +.Fn stack_save_td , +.Fn stack_zero , +or +.Fn stack_copy . +Alternatively, storage can be allocated dynamically with .Fn stack_create . The .Ar flags argument is passed to .Xr malloc 9 . -Memory associated with a trace is freed by calling +This dynamic allocation must be freed by calling .Fn stack_destroy . .Pp A trace of the current thread's kernel call stack may be captured using .Fn stack_save . .Fn stack_save_td can be used to capture the kernel stack of a caller-specified thread. -Callers of these functions must own the thread lock of the specified thread, +Callers of +.Fn stack_save_td +must own the thread lock of the specified thread, and the thread's stack must not be swapped out. .Fn stack_save_td can capture the kernel stack of a running thread, though note that this is