2006-07-03 01:24:38 -06:00
|
|
|
/*
|
|
|
|
* kernel/stacktrace.c
|
|
|
|
*
|
|
|
|
* Stack trace management functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
|
|
|
|
*/
|
|
|
|
#include <linux/sched.h>
|
2008-12-25 03:21:20 -07:00
|
|
|
#include <linux/kernel.h>
|
2011-05-23 12:51:41 -06:00
|
|
|
#include <linux/export.h>
|
2006-07-03 01:24:38 -06:00
|
|
|
#include <linux/kallsyms.h>
|
|
|
|
#include <linux/stacktrace.h>
|
|
|
|
|
|
|
|
void print_stack_trace(struct stack_trace *trace, int spaces)
|
|
|
|
{
|
2008-06-13 03:00:14 -06:00
|
|
|
int i;
|
2006-07-03 01:24:38 -06:00
|
|
|
|
2008-05-12 13:21:14 -06:00
|
|
|
if (WARN_ON(!trace->entries))
|
|
|
|
return;
|
|
|
|
|
2006-07-03 01:24:38 -06:00
|
|
|
for (i = 0; i < trace->nr_entries; i++) {
|
2008-06-13 03:00:14 -06:00
|
|
|
printk("%*c", 1 + spaces, ' ');
|
|
|
|
print_ip_sym(trace->entries[i]);
|
2006-07-03 01:24:38 -06:00
|
|
|
}
|
|
|
|
}
|
2008-06-27 13:20:17 -06:00
|
|
|
EXPORT_SYMBOL_GPL(print_stack_trace);
|
2006-07-03 01:24:38 -06:00
|
|
|
|
2008-12-25 03:21:20 -07:00
|
|
|
/*
|
2011-06-08 01:09:27 -06:00
|
|
|
* Architectures that do not implement save_stack_trace_tsk or
|
|
|
|
* save_stack_trace_regs get this weak alias and a once-per-bootup warning
|
|
|
|
* (whenever this facility is utilized - for example by procfs):
|
2008-12-25 03:21:20 -07:00
|
|
|
*/
|
|
|
|
__weak void
|
|
|
|
save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
|
|
|
|
{
|
|
|
|
WARN_ONCE(1, KERN_INFO "save_stack_trace_tsk() not implemented yet.\n");
|
|
|
|
}
|
2011-06-08 01:09:27 -06:00
|
|
|
|
|
|
|
__weak void
|
|
|
|
save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
|
|
|
|
{
|
|
|
|
WARN_ONCE(1, KERN_INFO "save_stack_trace_regs() not implemented yet.\n");
|
|
|
|
}
|