diff options
author | jeff <jeff@FreeBSD.org> | 2005-08-03 04:27:40 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-08-03 04:27:40 +0000 |
commit | 4a761caec7754f1fc2754466099320c54bf45abb (patch) | |
tree | 52986abea99ce3e4955fd106535de6f4e591bac2 /sys/arm | |
parent | 24f85b0b69c29af04dc033d110270b9a40a1bcaa (diff) | |
download | FreeBSD-src-4a761caec7754f1fc2754466099320c54bf45abb.zip FreeBSD-src-4a761caec7754f1fc2754466099320c54bf45abb.tar.gz |
- Add support for saving stack traces and displaying them via printf(9)
and KTR.
Contributed by: Antoine Brodin <antoine.brodin@laposte.net>
Concept code from: Neal Fachan <neal@isilon.com>
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/db_trace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c index 869713a..31ebfb9 100644 --- a/sys/arm/arm/db_trace.c +++ b/sys/arm/arm/db_trace.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/kdb.h> +#include <sys/stack.h> #include <machine/armreg.h> #include <machine/asm.h> #include <machine/cpufunc.h> @@ -219,3 +220,21 @@ db_trace_self(void) { db_trace_thread(curthread, -1); } + +void +stack_save(struct stack *st) +{ + vm_offset_t callpc; + u_int32_t *frame; + + stack_zero(st); + frame = (u_int32_t *)__builtin_frame_address(0); + while (1) { + if (!INKERNEL(frame)) + break; + callpc = frame[FR_SCP]; + if (stack_put(st, callpc) == -1) + break; + frame = (u_int32_t *)(frame[FR_RFP]); + } +} |