blob: 94b527ef1d1e37fe060ab812f13ef7276910549f [file] [log] [blame]
Ingo Molnar8637c092006-07-03 00:24:38 -07001/*
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>
Ingo Molnar85946982008-06-27 21:20:17 +02009#include <linux/module.h>
Ingo Molnar8637c092006-07-03 00:24:38 -070010#include <linux/kallsyms.h>
11#include <linux/stacktrace.h>
12
13void print_stack_trace(struct stack_trace *trace, int spaces)
14{
Vegard Nossuma5a242d2008-06-13 11:00:14 +020015 int i;
Ingo Molnar8637c092006-07-03 00:24:38 -070016
Johannes Bergbfeeeeb2008-05-12 21:21:14 +020017 if (WARN_ON(!trace->entries))
18 return;
19
Ingo Molnar8637c092006-07-03 00:24:38 -070020 for (i = 0; i < trace->nr_entries; i++) {
Vegard Nossuma5a242d2008-06-13 11:00:14 +020021 printk("%*c", 1 + spaces, ' ');
22 print_ip_sym(trace->entries[i]);
Ingo Molnar8637c092006-07-03 00:24:38 -070023 }
24}
Ingo Molnar85946982008-06-27 21:20:17 +020025EXPORT_SYMBOL_GPL(print_stack_trace);
Ingo Molnar8637c092006-07-03 00:24:38 -070026