1 #ifndef _LINUX_UNWIND_H
2 #define _LINUX_UNWIND_H
5 * Copyright (C) 2002-2006 Novell, Inc.
7 * This code is released under version 2 of the GNU GPL.
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
15 #include <linux/config.h>
19 #ifdef CONFIG_STACK_UNWIND
21 #include <asm/unwind.h>
23 #ifndef ARCH_UNWIND_SECTION_NAME
24 #define ARCH_UNWIND_SECTION_NAME ".eh_frame"
28 * Initialize unwind support.
30 extern void unwind_init(void);
32 extern void *unwind_add_table(struct module *,
33 const void *table_start,
34 unsigned long table_size);
36 extern void unwind_remove_table(void *handle, int init_only);
38 extern int unwind_init_frame_info(struct unwind_frame_info *,
40 /*const*/ struct pt_regs *);
43 * Prepare to unwind a blocked task.
45 extern int unwind_init_blocked(struct unwind_frame_info *,
46 struct task_struct *);
49 * Prepare to unwind the currently running thread.
51 extern int unwind_init_running(struct unwind_frame_info *,
52 asmlinkage int (*callback)(struct unwind_frame_info *,
57 * Unwind to previous to frame. Returns 0 if successful, negative
58 * number in case of an error.
60 extern int unwind(struct unwind_frame_info *);
63 * Unwind until the return pointer is in user-land (or until an error
64 * occurs). Returns 0 if successful, negative number in case of
67 extern int unwind_to_user(struct unwind_frame_info *);
71 struct unwind_frame_info {};
73 static inline void unwind_init(void) {}
75 static inline void *unwind_add_table(struct module *mod,
76 const void *table_start,
77 unsigned long table_size)
82 static inline void unwind_remove_table(void *handle, int init_only)
86 static inline int unwind_init_frame_info(struct unwind_frame_info *info,
87 struct task_struct *tsk,
88 const struct pt_regs *regs)
93 static inline int unwind_init_blocked(struct unwind_frame_info *info,
94 struct task_struct *tsk)
99 static inline int unwind_init_running(struct unwind_frame_info *info,
100 asmlinkage int (*cb)(struct unwind_frame_info *,
107 static inline int unwind(struct unwind_frame_info *info)
112 static inline int unwind_to_user(struct unwind_frame_info *info)
119 #endif /* _LINUX_UNWIND_H */