diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 15:48:15 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 15:48:15 -0500 |
| commit | 34161db6b14d984fb9b06c735b7b42f8803f6851 (patch) | |
| tree | 99656278b6697f1cde5b05894b7c0ee22c63a00e /arch/sh/kernel/stacktrace.c | |
| parent | 5847e1f4d058677c5e46dc6c3e3c70e8855ea3ba (diff) | |
| parent | 620034c84d1d939717bdfbe02c51a3fee43541c3 (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/ into merge_linus
Conflicts:
include/linux/sunrpc/xprt.h
net/sunrpc/xprtsock.c
Fix up conflicts with the workqueue changes.
Diffstat (limited to 'arch/sh/kernel/stacktrace.c')
| -rw-r--r-- | arch/sh/kernel/stacktrace.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/sh/kernel/stacktrace.c b/arch/sh/kernel/stacktrace.c new file mode 100644 index 000000000000..0d5268afe80f --- /dev/null +++ b/arch/sh/kernel/stacktrace.c | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* | ||
| 2 | * arch/sh/kernel/stacktrace.c | ||
| 3 | * | ||
| 4 | * Stack trace management functions | ||
| 5 | * | ||
| 6 | * Copyright (C) 2006 Paul Mundt | ||
| 7 | * | ||
| 8 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 9 | * License. See the file "COPYING" in the main directory of this archive | ||
| 10 | * for more details. | ||
| 11 | */ | ||
| 12 | #include <linux/sched.h> | ||
| 13 | #include <linux/stacktrace.h> | ||
| 14 | #include <linux/thread_info.h> | ||
| 15 | #include <asm/ptrace.h> | ||
| 16 | |||
| 17 | /* | ||
| 18 | * Save stack-backtrace addresses into a stack_trace buffer. | ||
| 19 | */ | ||
| 20 | void save_stack_trace(struct stack_trace *trace, struct task_struct *task) | ||
| 21 | { | ||
| 22 | unsigned long *sp; | ||
| 23 | |||
| 24 | if (!task) | ||
| 25 | task = current; | ||
| 26 | if (task == current) | ||
| 27 | sp = (unsigned long *)current_stack_pointer; | ||
| 28 | else | ||
| 29 | sp = (unsigned long *)task->thread.sp; | ||
| 30 | |||
| 31 | while (!kstack_end(sp)) { | ||
| 32 | unsigned long addr = *sp++; | ||
| 33 | |||
| 34 | if (__kernel_text_address(addr)) { | ||
| 35 | if (trace->skip > 0) | ||
| 36 | trace->skip--; | ||
| 37 | else | ||
| 38 | trace->entries[trace->nr_entries++] = addr; | ||
| 39 | if (trace->nr_entries >= trace->max_entries) | ||
| 40 | break; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | } | ||
