Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
8637c099 IM |
2 | #ifndef __LINUX_STACKTRACE_H |
3 | #define __LINUX_STACKTRACE_H | |
4 | ||
9a92a6ce JK |
5 | #include <linux/types.h> |
6 | ||
897312bd | 7 | struct task_struct; |
9c0729dc | 8 | struct pt_regs; |
897312bd | 9 | |
8637c099 IM |
10 | #ifdef CONFIG_STACKTRACE |
11 | struct stack_trace { | |
12 | unsigned int nr_entries, max_entries; | |
13 | unsigned long *entries; | |
5a1b3999 | 14 | int skip; /* input argument: How many entries to skip */ |
8637c099 IM |
15 | }; |
16 | ||
ab1b6f03 | 17 | extern void save_stack_trace(struct stack_trace *trace); |
39581062 MH |
18 | extern void save_stack_trace_regs(struct pt_regs *regs, |
19 | struct stack_trace *trace); | |
9745512c AV |
20 | extern void save_stack_trace_tsk(struct task_struct *tsk, |
21 | struct stack_trace *trace); | |
af085d90 JP |
22 | extern int save_stack_trace_tsk_reliable(struct task_struct *tsk, |
23 | struct stack_trace *trace); | |
8637c099 IM |
24 | |
25 | extern void print_stack_trace(struct stack_trace *trace, int spaces); | |
9a92a6ce JK |
26 | extern int snprint_stack_trace(char *buf, size_t size, |
27 | struct stack_trace *trace, int spaces); | |
02b67518 | 28 | |
8d26487f | 29 | #ifdef CONFIG_USER_STACKTRACE_SUPPORT |
02b67518 TE |
30 | extern void save_stack_trace_user(struct stack_trace *trace); |
31 | #else | |
32 | # define save_stack_trace_user(trace) do { } while (0) | |
33 | #endif | |
34 | ||
af085d90 | 35 | #else /* !CONFIG_STACKTRACE */ |
ab1b6f03 | 36 | # define save_stack_trace(trace) do { } while (0) |
9745512c | 37 | # define save_stack_trace_tsk(tsk, trace) do { } while (0) |
8d7c6a96 | 38 | # define save_stack_trace_user(trace) do { } while (0) |
3b5ad079 | 39 | # define print_stack_trace(trace, spaces) do { } while (0) |
9a92a6ce | 40 | # define snprint_stack_trace(buf, size, trace, spaces) do { } while (0) |
af085d90 JP |
41 | # define save_stack_trace_tsk_reliable(tsk, trace) ({ -ENOSYS; }) |
42 | #endif /* CONFIG_STACKTRACE */ | |
8637c099 | 43 | |
af085d90 | 44 | #endif /* __LINUX_STACKTRACE_H */ |