Bug 100028 - Debug information is incomplete or missing

Andrew Haley aph at redhat.com
Thu Mar 26 16:49:09 UTC 2009


This is my first stab at moving patches from IcedTea into OpenJDK.

Rather than creating a single overriding variable that enables debuginfo
everywhere I've used two, one for native files and one for class files.
Setting DEBUG_CLASSFILES=true in the toplevel forces all classes to be built
with full debuginfo, and DEBUG_BINARIES does the same for native binaries.
These make variables are entirely independent of the debug and optimization
setting.  This allows GNU/Linux distributions to build OpenJDK in a form
fit for distribution without patching makefiles or Ant buildfiles.  It also
means that the Ant variables javac.debug and javac.debuginfo are respected
everwhere in the build.

https://bugs.openjdk.java.net/show_bug.cgi?id=100028

Is this OK?

Andrew.


-------------- next part --------------
--- openjdk/langtools/src/share/opensource/javac/build.xml~	2008-11-25 09:17:57.000000000 +0000
+++ openjdk/langtools/src/share/opensource/javac/build.xml	2009-03-25 10:55:19.000000000 +0000
@@ -74,7 +74,7 @@
         <!-- to compile javac, set includeAntRuntime=no to prevent javac's 
         own tools.jar incorrectly appearing on the classpath -->
         <javac srcdir="${src.classes}" destdir="${build.bootclasses}"
-            source="${compiler.source.level}"  debug="true" debuglevel="source,lines"
+            source="${compiler.source.level}"  debug="true" debuglevel="${javac.debuglevel}"
             includeAntRuntime="no">
             <patternset refid="src.javac"/>
         </javac>
--- openjdk/langtools/make/Makefile~	2008-11-25 09:17:52.000000000 +0000
+++ openjdk/langtools/make/Makefile	2009-03-25 10:52:39.000000000 +0000
@@ -101,6 +101,11 @@
   endif
 endif
 
+ifeq ($(DEBUG_CLASSFILES), true)
+  ANT_OPTIONS += -Djavac.debug=true
+  ANT_OPTIONS += -Djavac.debuglevel=source,lines,vars
+endif
+
 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
 # and the somewhat misnamed CLASS_VERSION (-target NN)
 ifdef TARGET_CLASS_VERSION
--- openjdk/jaxws/make/Makefile~	2008-11-25 09:16:43.000000000 +0000
+++ openjdk/jaxws/make/Makefile	2009-03-25 10:52:23.000000000 +0000
@@ -69,6 +69,11 @@
   endif
 endif
 
+ifeq ($(DEBUG_CLASSFILES), true)
+  ANT_OPTIONS += -Djavac.debug=true
+  ANT_OPTIONS += -Djavac.debuglevel=source,lines,vars
+endif
+
 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
 # and the somewhat misnamed CLASS_VERSION (-target NN)
 ifdef TARGET_CLASS_VERSION
--- openjdk/jaxws/make/build.xml~	2008-11-25 09:16:43.000000000 +0000
+++ openjdk/jaxws/make/build.xml	2009-03-25 10:55:39.000000000 +0000
@@ -107,6 +107,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+	     debug="${javac.debug}"
              target="${javac.target}"
              excludes="com/sun/tools/internal/txw2/**">
          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
--- openjdk/jaxp/make/Makefile~	2008-11-25 09:15:03.000000000 +0000
+++ openjdk/jaxp/make/Makefile	2009-03-25 10:52:03.000000000 +0000
@@ -69,6 +69,11 @@
   endif
 endif
 
+ifeq ($(DEBUG_CLASSFILES), true)
+  ANT_OPTIONS += -Djavac.debug=true
+  ANT_OPTIONS += -Djavac.debuglevel=source,lines,vars
+endif
+
 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
 # and the somewhat misnamed CLASS_VERSION (-target NN)
 ifdef TARGET_CLASS_VERSION
--- openjdk/jaxp/make/build.xml~	2008-11-25 09:15:03.000000000 +0000
+++ openjdk/jaxp/make/build.xml	2009-03-25 10:49:13.000000000 +0000
@@ -85,6 +85,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+	     debug="${javac.debug}"
              target="${javac.target}">
          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
          <compilerarg line="${javac.version.opt}"/>
--- openjdk/jdk/make/common/Defs-linux.gmk~	2008-11-25 09:01:11.000000000 +0000
+++ openjdk/jdk/make/common/Defs-linux.gmk	2009-03-26 15:41:15.000000000 +0000
@@ -163,6 +163,12 @@
   endif
 endif
 
+# DEBUG_BINARIES overrides everything
+ifeq ($(DEBUG_BINARIES), true)
+  CFLAGS_REQUIRED += -g
+  DEBUG_FLAG = -g
+endif
+
 CFLAGS_OPT      = $(POPT)
 CFLAGS_DBG      = $(DEBUG_FLAG)
 CFLAGS_COMMON += $(CFLAGS_REQUIRED)
@@ -235,8 +241,11 @@
 #
 ifeq ($(VARIANT), OPT)
   ifneq ($(NO_STRIP), true)
-    # Debug 'strip -g' leaves local function Elf symbols (better stack traces)
-    POST_STRIP_PROCESS = $(STRIP) -g
+    ifneq ($(DEBUG_BINARIES), true)
+      # Debug 'strip -g' leaves local function Elf symbols (better stack
+      # traces)
+      POST_STRIP_PROCESS = $(STRIP) -g
+    endif
   endif
 endif
 
--- openjdk/jdk/make/sun/awt/mawt.gmk~	2008-11-25 09:01:23.000000000 +0000
+++ openjdk/jdk/make/sun/awt/mawt.gmk	2009-03-26 15:44:28.000000000 +0000
@@ -129,7 +129,9 @@
 #
 
 
-#CFLAGS += -g
+ifeq ($(DEBUG_BINARIES), true)
+  CFLAGS += -g
+endif
 ifeq ($(HEADLESS),true)
 CFLAGS += -DHEADLESS=$(HEADLESS)
 CPPFLAGS += -DHEADLESS=$(HEADLESS)
--- openjdk/control/make/make/sanity-rules.gmk~	2008-11-25 08:30:07.000000000 +0000
+++ openjdk/control/make/make/sanity-rules.gmk	2009-03-26 16:47:03.000000000 +0000
@@ -360,6 +360,8 @@
 ifeq ($(SPONSORS_SRC_AVAILABLE), true)
 	@$(ECHO) "   BUILD_SPONSORS = $(BUILD_SPONSORS) " >> $(MESSAGE_FILE)
 endif
+	@$(ECHO) "   DEBUG_CLASSFILES = $(DEBUG_CLASSFILES) " >> $(MESSAGE_FILE)
+	@$(ECHO) "   DEBUG_BINARIES = $(DEBUG_BINARIES) " >> $(MESSAGE_FILE)
 	@$(ECHO) "" >> $(MESSAGE_FILE)
 
 .PHONY: sanity settings pre-sanity insane \


More information about the build-dev mailing list