All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] microblaze: Support FRAME_POINTER for better backtrace
@ 2010-02-25 20:13 Steven J. Magnani
  2010-02-26  8:06 ` Michal Simek
  2010-03-01 23:04 ` Paul Mundt
  0 siblings, 2 replies; 8+ messages in thread
From: Steven J. Magnani @ 2010-02-25 20:13 UTC (permalink / raw)
  To: microblaze-uclinux; +Cc: monstr, linux-kernel, Steven J. Magnani

Add a FRAME_POINTER option and when it is enabled, use frame pointers
to walk the stack during a backtrace dump. This eliminates printout of
confusing "function calls" corresponding to stack values that look like they
might be return addresses, but aren't.

This patch is dependent upon
   [PATCH] microblaze: Begin stack dump with caller of dump_stack()

I'm not certain whether the MMU compiler generates frame pointers the same
way as the noMMU compiler I am using. I'm also not sure what all the 
ramifications of providing FRAME_POINTER are. It looks like tracing 
functionality makes use of it. Need someone familiar with these areas
to comment on the patch.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
---
diff -uprN a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
--- a/arch/microblaze/Kconfig.debug	2010-02-25 13:52:30.000000000 -0600
+++ b/arch/microblaze/Kconfig.debug	2010-02-25 13:52:49.000000000 -0600
@@ -26,4 +26,11 @@ config DEBUG_BOOTMEM
 	depends on DEBUG_KERNEL
 	bool "Debug BOOTMEM initialization"
 
+config FRAME_POINTER
+	bool "Use frame pointers"
+	default n
+	help
+	  If you say N here, the resulting kernel will be slightly smaller and
+	  faster. However, stack dumps will be much harder to interpret.
+
 endmenu
diff -uprN a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
--- a/arch/microblaze/kernel/traps.c	2010-02-25 13:50:00.000000000 -0600
+++ b/arch/microblaze/kernel/traps.c	2010-02-25 13:51:11.000000000 -0600
@@ -8,6 +8,7 @@
  * for more details.
  */
 
+#include <generated/autoconf.h>
 #include <linux/kernel.h>
 #include <linux/kallsyms.h>
 #include <linux/module.h>
@@ -44,7 +45,7 @@ void show_trace(struct task_struct *task
 	printk(KERN_NOTICE "\n");
 #endif
 	while (!kstack_end(stack)) {
-		addr = *stack++;
+		addr = *stack;
 		/*
 		 * If the address is either in the text segment of the
 		 * kernel, or in the region which contains vmalloc'ed
@@ -55,6 +56,13 @@ void show_trace(struct task_struct *task
 		 */
 		if (kernel_text_address(addr))
 			print_ip_sym(addr);
+
+#if defined(CONFIG_FRAME_POINTER)
+		/* Fetch the caller's frame pointer */
+		stack = (unsigned long *) stack[7];
+#else
+		stack++;
+#endif
 	}
 	printk(KERN_NOTICE "\n");
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-03-11  0:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 20:13 [RFC] microblaze: Support FRAME_POINTER for better backtrace Steven J. Magnani
2010-02-26  8:06 ` Michal Simek
2010-02-26 16:49   ` Steven J. Magnani
2010-03-01  1:43     ` Paul Mundt
2010-03-01 21:26       ` Steven J. Magnani
2010-03-10 22:51         ` Steven J. Magnani
2010-03-11  0:05           ` Paul Mundt
2010-03-01 23:04 ` Paul Mundt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.