FreeBSD kernel kern code
subr_stack.c File Reference
#include "opt_ddb.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/linker.h>
#include <sys/malloc.h>
#include <sys/sbuf.h>
#include <sys/stack.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
Include dependency graph for subr_stack.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
 FEATURE (stack, "Support for capturing kernel stack")
 
 MALLOC_DEFINE (M_STACK, "stack", "Stack Traces")
 
static int stack_symbol (vm_offset_t pc, char *namebuf, u_int buflen, long *offset, int flags)
 
static int stack_symbol_ddb (vm_offset_t pc, const char **name, long *offset)
 
struct stack * stack_create (int flags)
 
void stack_destroy (struct stack *st)
 
int stack_put (struct stack *st, vm_offset_t pc)
 
void stack_copy (const struct stack *src, struct stack *dst)
 
void stack_zero (struct stack *st)
 
void stack_print (const struct stack *st)
 
void stack_print_short (const struct stack *st)
 
void stack_print_ddb (const struct stack *st)
 
int stack_sbuf_print_flags (struct sbuf *sb, const struct stack *st, int flags, enum stack_sbuf_fmt format)
 
void stack_sbuf_print (struct sbuf *sb, const struct stack *st)
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ FEATURE()

FEATURE ( stack  ,
"Support for capturing kernel stack"   
)

◆ MALLOC_DEFINE()

MALLOC_DEFINE ( M_STACK  ,
"stack"  ,
"Stack Traces"   
)

◆ stack_copy()

void stack_copy ( const struct stack *  src,
struct stack *  dst 
)

Definition at line 82 of file subr_stack.c.

References src.

Referenced by sbuf_print_witness_badstacks(), and witness_checkorder().

Here is the caller graph for this function:

◆ stack_create()

struct stack * stack_create ( int  flags)

Definition at line 55 of file subr_stack.c.

References flags, malloc(), and st.

Here is the call graph for this function:

◆ stack_destroy()

void stack_destroy ( struct stack *  st)

Definition at line 64 of file subr_stack.c.

References free(), and st.

Here is the call graph for this function:

◆ stack_print()

void stack_print ( const struct stack *  st)

Definition at line 96 of file subr_stack.c.

References printf(), st, and stack_symbol().

Here is the call graph for this function:

◆ stack_print_ddb()

void stack_print_ddb ( const struct stack *  st)

Definition at line 132 of file subr_stack.c.

References name, printf(), st, and stack_symbol_ddb().

Referenced by kdb_backtrace(), and kdb_backtrace_thread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_print_short()

void stack_print_short ( const struct stack *  st)

Definition at line 112 of file subr_stack.c.

References printf(), st, and stack_symbol().

Here is the call graph for this function:

◆ stack_put()

int stack_put ( struct stack *  st,
vm_offset_t  pc 
)

Definition at line 71 of file subr_stack.c.

References st.

◆ stack_sbuf_print()

void stack_sbuf_print ( struct sbuf *  sb,
const struct stack *  st 
)

Definition at line 203 of file subr_stack.c.

References st, and stack_sbuf_print_flags().

Referenced by sbuf_print_witness_badstacks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_sbuf_print_flags()

int stack_sbuf_print_flags ( struct sbuf *  sb,
const struct stack *  st,
int  flags,
enum stack_sbuf_fmt  format 
)

Definition at line 173 of file subr_stack.c.

References flags, sbuf_nl_terminate(), sbuf_printf(), st, and stack_symbol().

Referenced by stack_sbuf_print(), tty_info(), and witness_checkorder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_symbol()

static int stack_symbol ( vm_offset_t  pc,
char *  namebuf,
u_int  buflen,
long *  offset,
int  flags 
)
static

Definition at line 255 of file subr_stack.c.

References flags, and linker_search_symbol_name_flags().

Referenced by stack_print(), stack_print_short(), and stack_sbuf_print_flags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_symbol_ddb()

static int stack_symbol_ddb ( vm_offset_t  pc,
const char **  name,
long *  offset 
)
static

Definition at line 271 of file subr_stack.c.

References linker_ddb_search_symbol(), linker_ddb_symbol_values(), name, and sym.

Referenced by stack_print_ddb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_zero()

void stack_zero ( struct stack *  st)

Definition at line 89 of file subr_stack.c.

References st.

Referenced by kdb_backtrace(), sbuf_print_witness_badstacks(), witness_debugger(), and witness_lock_order_add().

Here is the caller graph for this function: