| 1 |
#include <linux/string.h> |
| 2 |
#include <linux/sched.h> |
| 3 |
#include <linux/stacktrace.h> |
| 4 |
#include <asm/stacktrace.h> |
| 5 |
|
| 6 |
void foo(struct task_struct *foo); |
| 7 |
|
| 8 |
void foo(struct task_struct *foo) |
| 9 |
{ |
| 10 |
struct stack_trace trace; |
| 11 |
unsigned long backtrace[20]; |
| 12 |
memset(&trace, 0, sizeof(trace)); |
| 13 |
trace.entries = &backtrace[0]; |
| 14 |
trace.max_entries = 20; |
| 15 |
trace.skip = 0; |
| 16 |
save_stack_trace_tsk(foo, &trace); |
| 17 |
} |
| 18 |
|
| 19 |
static const struct stacktrace_ops print_stack_ops; |
| 20 |
|
| 21 |
void dumper(struct task_struct *foo); |
| 22 |
|
| 23 |
void dumper(struct task_struct *foo) |
| 24 |
{ |
| 25 |
dump_trace(foo, 0, 0, 0, &print_stack_ops, 0); |
| 26 |
} |