1 /* 2 * Header for stack related functions 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Library General Public License version 2. 6 */ 7 #ifndef _STACK_H_ 8 #define _STACK_H_ 9 10 #include <libcflat.h> 11 #include <asm/stack.h> 12 13 #ifdef HAVE_ARCH_BACKTRACE_FRAME 14 extern int arch_backtrace_frame(const void *frame, const void **return_addrs, 15 int max_depth, bool current_frame); 16 17 static inline int backtrace_frame(const void *frame, const void **return_addrs, 18 int max_depth) 19 { 20 return arch_backtrace_frame(frame, return_addrs, max_depth, false); 21 } 22 23 static inline int backtrace(const void **return_addrs, int max_depth) 24 { 25 return arch_backtrace_frame(NULL, return_addrs, max_depth, true); 26 } 27 #else 28 extern int backtrace(const void **return_addrs, int max_depth); 29 30 static inline int backtrace_frame(const void *frame, const void **return_addrs, 31 int max_depth) 32 { 33 return 0; 34 } 35 #endif 36 37 bool __attribute__((weak)) arch_base_address(const void *rebased_addr, unsigned long *addr); 38 39 #endif 40