mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
![Levin, Alexander (Sasha Levin)](/assets/img/avatar_default.png)
Move to using tools/include/ instead. Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: acme@redhat.com Link: http://lkml.kernel.org/r/20170531003747.10557-2-alexander.levin@verizon.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
32 lines
639 B
C
32 lines
639 B
C
#ifndef _LIBLOCKDEP_LINUX_STACKTRACE_H_
|
|
#define _LIBLOCKDEP_LINUX_STACKTRACE_H_
|
|
|
|
#include <execinfo.h>
|
|
|
|
struct stack_trace {
|
|
unsigned int nr_entries, max_entries;
|
|
unsigned long *entries;
|
|
int skip;
|
|
};
|
|
|
|
static inline void print_stack_trace(struct stack_trace *trace, int spaces)
|
|
{
|
|
backtrace_symbols_fd((void **)trace->entries, trace->nr_entries, 1);
|
|
}
|
|
|
|
#define save_stack_trace(trace) \
|
|
((trace)->nr_entries = \
|
|
backtrace((void **)(trace)->entries, (trace)->max_entries))
|
|
|
|
static inline int dump_stack(void)
|
|
{
|
|
void *array[64];
|
|
size_t size;
|
|
|
|
size = backtrace(array, 64);
|
|
backtrace_symbols_fd(array, size, 1);
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif
|