sh: Use the new stack unwinder API
authorMatt Fleming <matt@console-pimps.org>
Tue, 11 Aug 2009 21:43:20 +0000 (22:43 +0100)
committerPaul Mundt <lethal@linux-sh.org>
Thu, 13 Aug 2009 10:52:53 +0000 (19:52 +0900)
Instead of implementing our own stack unwinder via dump_trace() we
should use the new stack unwinder API because it is more modular. This
change allows us to decouple the interface for generating stacktraces
from the implementation of a stack unwinder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/dumpstack.c
arch/sh/kernel/stacktrace.c
arch/sh/oprofile/backtrace.c

index 6ab996fc61216272912b1f6ceef45dbeb977a77c..005dc1d1146051330580df4ad8693a243da0c894 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/kallsyms.h>
 #include <linux/ftrace.h>
 #include <linux/debug_locks.h>
-
+#include <asm/unwinder.h>
 #include <asm/stacktrace.h>
 
 void printk_address(unsigned long address, int reliable)
@@ -46,13 +46,10 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
 { }
 #endif
 
-/*
- * Unwind the call stack and pass information to the stacktrace_ops
- * functions.
- */
-void dump_trace(struct task_struct *task, struct pt_regs *regs,
-               unsigned long *sp, const struct stacktrace_ops *ops,
-               void *data)
+void
+stack_reader_dump(struct task_struct *task, struct pt_regs *regs,
+                 unsigned long *sp, const struct stacktrace_ops *ops,
+                 void *data)
 {
        struct thread_info *context;
        int graph = 0;
@@ -71,8 +68,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
                }
        }
 }
-EXPORT_SYMBOL(dump_trace);
-
 
 static void
 print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
@@ -117,7 +112,7 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
 
        printk("\nCall trace:\n");
 
-       dump_trace(tsk, regs, sp, &print_trace_ops, "");
+       unwind_stack(tsk, regs, sp, &print_trace_ops, "");
 
        printk("\n");
 
index 6c24a400b05e761dccb41f8c195c4374e508018b..45b1adde3abedeee3b928e6c28cd21195baaee04 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/stacktrace.h>
 #include <linux/thread_info.h>
 #include <linux/module.h>
+#include <asm/unwinder.h>
 #include <asm/ptrace.h>
 #include <asm/stacktrace.h>
 
@@ -57,7 +58,7 @@ void save_stack_trace(struct stack_trace *trace)
 {
        unsigned long *sp = (unsigned long *)current_stack_pointer;
 
-       dump_trace(current, NULL, sp,  &save_stack_ops, trace);
+       unwind_stack(current, NULL, sp,  &save_stack_ops, trace);
 }
 EXPORT_SYMBOL_GPL(save_stack_trace);
 
@@ -89,6 +90,6 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
        unsigned long *sp = (unsigned long *)tsk->thread.sp;
 
-       dump_trace(current, NULL, sp,  &save_stack_ops_nosched, trace);
+       unwind_stack(current, NULL, sp,  &save_stack_ops_nosched, trace);
 }
 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
index 62e4e4d0273e26fda1d5e63aed9787a8a829029c..37cd75d7930e8aff20788020ac7b09ae3ecc9b31 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/kallsyms.h>
 #include <linux/mm.h>
+#include <asm/unwinder.h>
 #include <asm/ptrace.h>
 #include <asm/uaccess.h>
 #include <asm/sections.h>
@@ -120,8 +121,8 @@ void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
        stackaddr = (unsigned long *)regs->regs[15];
        if (!user_mode(regs)) {
                if (depth)
-                       dump_trace(NULL, regs, stackaddr,
-                                  &backtrace_ops, &depth);
+                       unwind_stack(NULL, regs, stackaddr,
+                                    &backtrace_ops, &depth);
                return;
        }