This source file includes following definitions.
- dump_trace
- save_stack_trace
- save_stack_trace_tsk
1
2
3
4
5
6
7
8
9
10
11 #include <linux/module.h>
12 #include <linux/stacktrace.h>
13
14 #include <asm/unwind.h>
15
16 static void dump_trace(struct task_struct *task, struct stack_trace *trace)
17 {
18 struct unwind_frame_info info;
19
20 unwind_frame_init_task(&info, task, NULL);
21
22
23 trace->nr_entries = 0;
24 while (trace->nr_entries < trace->max_entries) {
25 if (unwind_once(&info) < 0 || info.ip == 0)
26 break;
27
28 if (__kernel_text_address(info.ip))
29 trace->entries[trace->nr_entries++] = info.ip;
30 }
31 }
32
33
34
35
36 void save_stack_trace(struct stack_trace *trace)
37 {
38 dump_trace(current, trace);
39 }
40 EXPORT_SYMBOL_GPL(save_stack_trace);
41
42 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
43 {
44 dump_trace(tsk, trace);
45 }
46 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);