public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 20/21] KGDB: Add ability to unoptimize module compiles and dwarf2 asm
@ 2007-10-15 18:34 Jason Wessel
  0 siblings, 0 replies; only message in thread
From: Jason Wessel @ 2007-10-15 18:34 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 57 bytes --]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

[-- Attachment #2: asm_debug.patch --]
[-- Type: text/x-patch, Size: 1520 bytes --]

asm_debug.patch

From: Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH] Add ability to unoptimize module compiles and dwarf2 asm

This patch adds in the ability to unoptimize a single kernel module to
make source stepping more linear and not optimize out variables that
the developer might like to inspect.  It used with adding
COPTIMIZE=-O0 to the build line.

Also when creating a debug kernel add in dwarf2 sections for the
assembled code.  This makes source stepping the assembly files
possible as well as having references into the .S files in the back
trace information.  The -gdwarf2 was chosen to work around any
problems with the stabs assembly sections.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 Makefile |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-kgdb/Makefile
===================================================================
--- linux-2.6-kgdb.orig/Makefile
+++ linux-2.6-kgdb/Makefile
@@ -483,10 +483,14 @@ endif # $(dot-config)
 all: vmlinux
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-CFLAGS		+= -Os
+COPTIMIZE	= -Os
 else
-CFLAGS		+= -O2
+COPTIMIZE	= -O2
 endif
+# COPTIMIZE may be overridden on the make command line with
+# 	make ... COPTIMIZE=""
+# The resulting object may be easier to debug with KGDB
+CFLAGS		+= $(COPTIMIZE)
 
 include $(srctree)/arch/$(ARCH)/Makefile
 
@@ -498,6 +502,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO
 CFLAGS		+= -g
+AFLAGS		+= -gdwarf2
 endif
 
 # Force gcc to behave correct even for buggy distributions

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-15 18:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 18:34 [PATCH 20/21] KGDB: Add ability to unoptimize module compiles and dwarf2 asm Jason Wessel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox