diff options
author | Franck Bui-Huu <vagabon.xyz@gmail.com> | 2006-08-03 03:29:17 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-09-27 08:37:26 -0400 |
commit | 87151ae39bf5556abe83d69af0be9580c32c501b (patch) | |
tree | 5e5a39ef8b8f75d4980791b0bffb7413ed199e6e /arch | |
parent | cf495a333093a1c0eca90c7d8d98313a3b7f01a1 (diff) |
[MIPS] Miscellaneous cleanup in prologue analysis code
We usually use backtrace term for dumping a call tree during
debug. Therefore this patch renames show_frametrace() into
show_backtrace() and show_trace() into show_raw_backtrace().
It also uses the new function print_ip_sym().
Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/traps.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 4a11a3d8447d..549cbb8209a3 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -74,21 +74,18 @@ void (*board_ejtag_handler_setup)(void); | |||
74 | void (*board_bind_eic_interrupt)(int irq, int regset); | 74 | void (*board_bind_eic_interrupt)(int irq, int regset); |
75 | 75 | ||
76 | 76 | ||
77 | static void show_trace(unsigned long *stack) | 77 | static void show_raw_backtrace(unsigned long *sp) |
78 | { | 78 | { |
79 | const int field = 2 * sizeof(unsigned long); | ||
80 | unsigned long addr; | 79 | unsigned long addr; |
81 | 80 | ||
82 | printk("Call Trace:"); | 81 | printk("Call Trace:"); |
83 | #ifdef CONFIG_KALLSYMS | 82 | #ifdef CONFIG_KALLSYMS |
84 | printk("\n"); | 83 | printk("\n"); |
85 | #endif | 84 | #endif |
86 | while (!kstack_end(stack)) { | 85 | while (!kstack_end(sp)) { |
87 | addr = *stack++; | 86 | addr = *sp++; |
88 | if (__kernel_text_address(addr)) { | 87 | if (__kernel_text_address(addr)) |
89 | printk(" [<%0*lx>] ", field, addr); | 88 | print_ip_sym(addr); |
90 | print_symbol("%s\n", addr); | ||
91 | } | ||
92 | } | 89 | } |
93 | printk("\n"); | 90 | printk("\n"); |
94 | } | 91 | } |
@@ -104,22 +101,20 @@ __setup("raw_show_trace", set_raw_show_trace); | |||
104 | 101 | ||
105 | extern unsigned long unwind_stack(struct task_struct *task, | 102 | extern unsigned long unwind_stack(struct task_struct *task, |
106 | unsigned long **sp, unsigned long pc); | 103 | unsigned long **sp, unsigned long pc); |
107 | static void show_frametrace(struct task_struct *task, struct pt_regs *regs) | 104 | static void show_backtrace(struct task_struct *task, struct pt_regs *regs) |
108 | { | 105 | { |
109 | const int field = 2 * sizeof(unsigned long); | 106 | unsigned long *sp = (long *)regs->regs[29]; |
110 | unsigned long *stack = (long *)regs->regs[29]; | ||
111 | unsigned long pc = regs->cp0_epc; | 107 | unsigned long pc = regs->cp0_epc; |
112 | int top = 1; | 108 | int top = 1; |
113 | 109 | ||
114 | if (raw_show_trace || !__kernel_text_address(pc)) { | 110 | if (raw_show_trace || !__kernel_text_address(pc)) { |
115 | show_trace(stack); | 111 | show_raw_backtrace(sp); |
116 | return; | 112 | return; |
117 | } | 113 | } |
118 | printk("Call Trace:\n"); | 114 | printk("Call Trace:\n"); |
119 | while (__kernel_text_address(pc)) { | 115 | while (__kernel_text_address(pc)) { |
120 | printk(" [<%0*lx>] ", field, pc); | 116 | print_ip_sym(pc); |
121 | print_symbol("%s\n", pc); | 117 | pc = unwind_stack(task, &sp, pc); |
122 | pc = unwind_stack(task, &stack, pc); | ||
123 | if (top && pc == 0) | 118 | if (top && pc == 0) |
124 | pc = regs->regs[31]; /* leaf? */ | 119 | pc = regs->regs[31]; /* leaf? */ |
125 | top = 0; | 120 | top = 0; |
@@ -127,7 +122,7 @@ static void show_frametrace(struct task_struct *task, struct pt_regs *regs) | |||
127 | printk("\n"); | 122 | printk("\n"); |
128 | } | 123 | } |
129 | #else | 124 | #else |
130 | #define show_frametrace(task, r) show_trace((long *)(r)->regs[29]); | 125 | #define show_backtrace(task, r) show_raw_backtrace((long *)(r)->regs[29]); |
131 | #endif | 126 | #endif |
132 | 127 | ||
133 | /* | 128 | /* |
@@ -160,7 +155,7 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs) | |||
160 | i++; | 155 | i++; |
161 | } | 156 | } |
162 | printk("\n"); | 157 | printk("\n"); |
163 | show_frametrace(task, regs); | 158 | show_backtrace(task, regs); |
164 | } | 159 | } |
165 | 160 | ||
166 | static noinline void prepare_frametrace(struct pt_regs *regs) | 161 | static noinline void prepare_frametrace(struct pt_regs *regs) |
@@ -211,11 +206,11 @@ void dump_stack(void) | |||
211 | if (!raw_show_trace) { | 206 | if (!raw_show_trace) { |
212 | struct pt_regs regs; | 207 | struct pt_regs regs; |
213 | prepare_frametrace(®s); | 208 | prepare_frametrace(®s); |
214 | show_frametrace(current, ®s); | 209 | show_backtrace(current, ®s); |
215 | return; | 210 | return; |
216 | } | 211 | } |
217 | #endif | 212 | #endif |
218 | show_trace(&stack); | 213 | show_raw_backtrace(&stack); |
219 | } | 214 | } |
220 | 215 | ||
221 | EXPORT_SYMBOL(dump_stack); | 216 | EXPORT_SYMBOL(dump_stack); |