stacktrace.c 896 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * kernel/stacktrace.c
  3. *
  4. * Stack trace management functions
  5. *
  6. * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  7. */
  8. #include <linux/sched.h>
  9. #include <linux/kernel.h>
  10. #include <linux/module.h>
  11. #include <linux/kallsyms.h>
  12. #include <linux/stacktrace.h>
  13. void print_stack_trace(struct stack_trace *trace, int spaces)
  14. {
  15. int i;
  16. if (WARN_ON(!trace->entries))
  17. return;
  18. for (i = 0; i < trace->nr_entries; i++) {
  19. printk("%*c", 1 + spaces, ' ');
  20. print_ip_sym(trace->entries[i]);
  21. }
  22. }
  23. EXPORT_SYMBOL_GPL(print_stack_trace);
  24. /*
  25. * Architectures that do not implement save_stack_trace_tsk get this
  26. * weak alias and a once-per-bootup warning (whenever this facility
  27. * is utilized - for example by procfs):
  28. */
  29. __weak void
  30. save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
  31. {
  32. WARN_ONCE(1, KERN_INFO "save_stack_trace_tsk() not implemented yet.\n");
  33. }