Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[deliverable/linux.git] / arch / x86 / kernel / stacktrace.c
CommitLineData
21b32bbf 1/*
21b32bbf
IM
2 * Stack trace management functions
3 *
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 */
6#include <linux/sched.h>
7#include <linux/stacktrace.h>
c0b766f1
AK
8#include <linux/module.h>
9#include <asm/stacktrace.h>
21b32bbf 10
c0b766f1 11static void save_stack_warning(void *data, char *msg)
21b32bbf 12{
21b32bbf
IM
13}
14
c0b766f1
AK
15static void
16save_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
21b32bbf 17{
21b32bbf
IM
18}
19
c0b766f1 20static int save_stack_stack(void *data, char *name)
21b32bbf 21{
ab1b6f03 22 return -1;
c0b766f1 23}
21b32bbf 24
c0b766f1
AK
25static void save_stack_address(void *data, unsigned long addr)
26{
27 struct stack_trace *trace = (struct stack_trace *)data;
28 if (trace->skip > 0) {
29 trace->skip--;
30 return;
21b32bbf 31 }
006e84ee 32 if (trace->nr_entries < trace->max_entries)
c0b766f1 33 trace->entries[trace->nr_entries++] = addr;
21b32bbf
IM
34}
35
c0b766f1
AK
36static struct stacktrace_ops save_stack_ops = {
37 .warning = save_stack_warning,
38 .warning_symbol = save_stack_warning_symbol,
39 .stack = save_stack_stack,
40 .address = save_stack_address,
41};
21b32bbf
IM
42
43/*
44 * Save stack-backtrace addresses into a stack_trace buffer.
21b32bbf 45 */
ab1b6f03 46void save_stack_trace(struct stack_trace *trace)
21b32bbf 47{
ab1b6f03 48 dump_trace(current, NULL, NULL, &save_stack_ops, trace);
006e84ee
CM
49 if (trace->nr_entries < trace->max_entries)
50 trace->entries[trace->nr_entries++] = ULONG_MAX;
21b32bbf 51}
c0b766f1 52EXPORT_SYMBOL(save_stack_trace);
This page took 0.219659 seconds and 5 git commands to generate.