diff options
author | pjd <pjd@FreeBSD.org> | 2005-08-29 11:34:08 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-08-29 11:34:08 +0000 |
commit | a520307ce1003200de2b34850148fa2cb96c5af9 (patch) | |
tree | aa4d66df32cdb7fc523586e11a0974002ee1a249 /sys/kern/subr_stack.c | |
parent | a469be1ef35339bc40e26dc3259862541751daca (diff) | |
download | FreeBSD-src-a520307ce1003200de2b34850148fa2cb96c5af9.zip FreeBSD-src-a520307ce1003200de2b34850148fa2cb96c5af9.tar.gz |
Add 'depth' argument to CTRSTACK() macro, which allows to reduce number
of ktr slots used. If 'depth' is equal to 0, the whole stack will be
logged, just like before.
Diffstat (limited to 'sys/kern/subr_stack.c')
-rw-r--r-- | sys/kern/subr_stack.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/subr_stack.c b/sys/kern/subr_stack.c index 9b2be7b..47dd205 100644 --- a/sys/kern/subr_stack.c +++ b/sys/kern/subr_stack.c @@ -115,7 +115,8 @@ stack_sbuf_print(struct sbuf *sb, struct stack *st) #ifdef KTR void -stack_ktr(u_int mask, const char *file, int line, struct stack *st, int cheap) +stack_ktr(u_int mask, const char *file, int line, struct stack *st, u_int depth, + int cheap) { const char *name; long offset; @@ -136,12 +137,15 @@ stack_ktr(u_int mask, const char *file, int line, struct stack *st, int cheap) ktr_tracepoint(mask, file, line, "#2 %p %p %p %p %p %p", st->pcs[12], st->pcs[13], st->pcs[14], st->pcs[15], st->pcs[16], st->pcs[17]); - } else - for (i = 0; i < st->depth; i++) { + } else { + if (depth == 0 || st->depth < depth) + depth = st->depth; + for (i = 0; i < depth; i++) { stack_symbol(st->pcs[i], &name, &offset); ktr_tracepoint(mask, file, line, "#%d %p at %s+%#lx", i, st->pcs[i], (u_long)name, offset, 0, 0); } + } } #endif |