Linux 4.6-rc6
[linux/fpc-iii.git] / arch / ia64 / kernel / stacktrace.c
blob5af2783a87f441eb3773a6d4b32a7be76fda6793
1 /*
2 * arch/ia64/kernel/stacktrace.c
4 * Stack trace management functions
6 */
7 #include <linux/sched.h>
8 #include <linux/stacktrace.h>
9 #include <linux/module.h>
11 static void
12 ia64_do_save_stack(struct unw_frame_info *info, void *arg)
14 struct stack_trace *trace = arg;
15 unsigned long ip;
16 int skip = trace->skip;
18 trace->nr_entries = 0;
19 do {
20 unw_get_ip(info, &ip);
21 if (ip == 0)
22 break;
23 if (skip == 0) {
24 trace->entries[trace->nr_entries++] = ip;
25 if (trace->nr_entries == trace->max_entries)
26 break;
27 } else
28 skip--;
29 } while (unw_unwind(info) >= 0);
33 * Save stack-backtrace addresses into a stack_trace buffer.
35 void save_stack_trace(struct stack_trace *trace)
37 unw_init_running(ia64_do_save_stack, trace);
39 EXPORT_SYMBOL(save_stack_trace);