linux-mips
[Top] [All Lists]

[PATCH 5/7] Simplify dump_stack()

To: anemo@mba.ocn.ne.jp
Subject: [PATCH 5/7] Simplify dump_stack()
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
Date: Thu, 3 Aug 2006 09:29:19 +0200
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org, Franck Bui-Huu <vagabon.xyz@gmail.com>
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=H515uSuTIr4+ErLSjYXkPkBr3pMSl34zdUtWwJv6hHDKnPHiH3kN/+PTQUcpEi4FhCx7OY6I36PYGp65cG0uSBs1jSfdIAodIp26JlDlzEQ4a8TcV0jeEri9AO/kYVpLq3X2p02VYUDdGtT99vKbmDqA38o0+j+BroHGyP7Y/RA=
In-reply-to: <11545901611096-git-send-email-vagabon.xyz@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <11545901611096-git-send-email-vagabon.xyz@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Make dump_stack() code not depend on CONFIG_KALLSYMS.

It also make prepare_frametrace() always inlined to get
less false entries reported by show_raw_backtrace().

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
---
 arch/mips/kernel/traps.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 549cbb8..303f008 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -158,7 +158,7 @@ static void show_stacktrace(struct task_
        show_backtrace(task, regs);
 }
 
-static noinline void prepare_frametrace(struct pt_regs *regs)
+static __always_inline void prepare_frametrace(struct pt_regs *regs)
 {
        __asm__ __volatile__(
                "1: la $2, 1b\n\t"
@@ -200,17 +200,15 @@ void show_stack(struct task_struct *task
  */
 void dump_stack(void)
 {
-       unsigned long stack;
+       struct pt_regs regs;
 
-#ifdef CONFIG_KALLSYMS
-       if (!raw_show_trace) {
-               struct pt_regs regs;
-               prepare_frametrace(&regs);
-               show_backtrace(current, &regs);
-               return;
-       }
-#endif
-       show_raw_backtrace(&stack);
+       /*
+        * Remove any garbage that may be in regs (specially func
+        * addresses) to avoid show_raw_backtrace() to report them
+        */
+       memset(&regs, 0, sizeof(regs));
+       prepare_frametrace(&regs);
+       show_backtrace(current, &regs);
 }
 
 EXPORT_SYMBOL(dump_stack);
-- 
1.4.2.rc2


<Prev in Thread] Current Thread [Next in Thread>