linux/include/linux/stacktrace.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef __LINUX_STACKTRACE_H
   3#define __LINUX_STACKTRACE_H
   4
   5#include <linux/types.h>
   6
   7struct task_struct;
   8struct pt_regs;
   9
  10#ifdef CONFIG_STACKTRACE
  11struct stack_trace {
  12        unsigned int nr_entries, max_entries;
  13        unsigned long *entries;
  14        int skip;       /* input argument: How many entries to skip */
  15};
  16
  17extern void save_stack_trace(struct stack_trace *trace);
  18extern void save_stack_trace_regs(struct pt_regs *regs,
  19                                  struct stack_trace *trace);
  20extern void save_stack_trace_tsk(struct task_struct *tsk,
  21                                struct stack_trace *trace);
  22extern int save_stack_trace_tsk_reliable(struct task_struct *tsk,
  23                                         struct stack_trace *trace);
  24
  25extern void print_stack_trace(struct stack_trace *trace, int spaces);
  26extern int snprint_stack_trace(char *buf, size_t size,
  27                        struct stack_trace *trace, int spaces);
  28
  29#ifdef CONFIG_USER_STACKTRACE_SUPPORT
  30extern void save_stack_trace_user(struct stack_trace *trace);
  31#else
  32# define save_stack_trace_user(trace)              do { } while (0)
  33#endif
  34
  35#else /* !CONFIG_STACKTRACE */
  36# define save_stack_trace(trace)                        do { } while (0)
  37# define save_stack_trace_tsk(tsk, trace)               do { } while (0)
  38# define save_stack_trace_user(trace)                   do { } while (0)
  39# define print_stack_trace(trace, spaces)               do { } while (0)
  40# define snprint_stack_trace(buf, size, trace, spaces)  do { } while (0)
  41# define save_stack_trace_tsk_reliable(tsk, trace)      ({ -ENOSYS; })
  42#endif /* CONFIG_STACKTRACE */
  43
  44#endif /* __LINUX_STACKTRACE_H */
  45