Add support for better backtraces
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 13 Jul 2016 16:46:02 +0000 (12:46 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 19 Jul 2016 15:43:10 +0000 (11:43 -0400)
At the cost of performance.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
Kconfig
Makefile
Makelocal.template

diff --git a/Kconfig b/Kconfig
index 215e6db..0813fed 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -252,6 +252,14 @@ config BLOCK_EXTRAS
                implementation.  Say y.  If you have networking bugs, try turning this
                off, and if that helps, tell someone.
 
+config BETTER_BACKTRACE
+       bool "Better backtraces, less optimizations"
+       default n
+       help
+               The kernel uses the frame pointer and call stacks for backtraces.
+               Tail-call optimizations remove some of this information.  Say 'Y' here
+               to have better backtraces, at the expense of performance.
+
 endmenu
 
 menu "Misc/Old Options"
index 5a95b57..12fe6c3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -369,6 +369,9 @@ CFLAGS_KERNEL += -m64 -g
 else
 CFLAGS_KERNEL += -m32 -gstabs
 endif
+ifeq ($(CONFIG_BETTER_BACKTRACE),y)
+CFLAGS_KERNEL += -fno-optimize-sibling-calls
+endif
 
 # TODO: do we need this, or can we rely on the compiler's defines?
 CFLAGS_KERNEL += -D$(ARCH)
index 54816b0..23ef9c6 100644 (file)
@@ -2,7 +2,10 @@
 #CFLAGS_USER += -DCONFIG_APPSERVER
 #CFLAGS_USER += -DCONFIG_SYSCALL_TRAP
 #CFLAGS_USER += -g
+# Turn this on for better backtraces, but worse performance
+#CFLAGS_USER += -fno-optimize-sibling-calls
 #CFLAGS_TESTS += -static
+#CFLAGS_TESTS += -fno-optimize-sibling-calls
 export CFLAGS_USER CFLAGS_TESTS
 
 # brho's custom targets.  Customize to your system.