7071907: JDK: Full Debug Symbols

Add initial FDS support to some libraries and programs.

Reviewed-by: kamg, fparain, sspitsyn, dsamersoff
This commit is contained in:
Daniel D. Daugherty 2012-04-11 07:26:35 -07:00
parent 25e2d2bf5c
commit 5017ee9fdb
26 changed files with 186 additions and 27 deletions
jdk/make
com/sun/tools/attach
common
java
instrument
java_crw_demo
java_hprof_demo
main/java
management
npt
verify
jpda
jdwp
transport/socket
launchers
mkdemo/jvmti
compiledMethodLoad
gctest
heapTracker
heapViewer
hprof
minst
mtrace
versionCheck
waiters
sun/tracing/dtrace

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../../..
PACKAGE = com.sun.tools.attach
LIBRARY = attach

@ -131,8 +131,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
# JDK build to import .debuginfo or .diz files from the HotSpot build.
# However, adding FDS support to the JDK build will occur in phases
# so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS)
# is used to indicate that a particular library supports FDS.
# so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
# and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
# particular library or program supports FDS.
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
@ -261,6 +262,17 @@ ifeq ($(DEBUG_BINARIES), true)
CFLAGS_REQUIRED += $(DEBUG_FLAG)
endif
# If Full Debug Symbols is enabled, then we want the same debug and
# optimization flags as used by FASTDEBUG.
#
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
ifeq ($(VARIANT), OPT)
CC_OPT = $(DEBUG_FLAG) $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
endif
endif
endif
CFLAGS_OPT = $(CC_OPT)
CFLAGS_DBG = $(DEBUG_FLAG)
CFLAGS_COMMON += $(CFLAGS_REQUIRED)

@ -138,8 +138,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
# JDK build to import .debuginfo or .diz files from the HotSpot build.
# However, adding FDS support to the JDK build will occur in phases
# so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS)
# is used to indicate that a particular library supports FDS.
# so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
# and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
# particular library or program supports FDS.
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
@ -240,6 +241,21 @@ ifeq ($(FASTDEBUG), true)
CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
endif
# If Full Debug Symbols is enabled, then we want the same debug and
# optimization flags as used by FASTDEBUG. We also want all the
# debug info in one place (-xs).
#
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
ifeq ($(VARIANT), OPT)
CC_OPT = -g -xs $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
CXX_OPT = -g0 -xs $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
endif
CFLAGS_DEBUG_OPTION += -xs
CXXFLAGS_DEBUG_OPTION += -xs
endif
endif
CFLAGS_COMMON = -L$(OBJDIR)
# Do not allow C99 language features like declarations in code etc.

@ -181,8 +181,17 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
$(CP) $(OBJDIR)/$(@F) $@
@$(call binary_file_verification,$@)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(ZIP_DEBUGINFO_FILES),1)
(set -e ; \
$(CD) $(OBJDIR) ; \
$(ZIPEXE) -q $(LIBRARY).diz $(LIBRARY).map $(LIBRARY).pdb ; \
)
$(CP) $(OBJDIR)/$(LIBRARY).diz $(@D)
$(RM) $(OBJDIR)/$(LIBRARY).map $(OBJDIR)/$(LIBRARY).pdb
else
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
endif
endif
endif # LIBRARY
@ -248,6 +257,37 @@ else # LIBRARY
ifeq ($(WRITE_LIBVERSION),true)
$(MCS) -d -a "$(FULL_VERSION)" $@
endif # WRITE_LIBVERSION
ifneq ($(PLATFORM), macosx)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
(set -e ; \
$(CD) $(@D) ; \
$(OBJCOPY) --only-keep-debug $(@F) $(LIBRARY).debuginfo ; \
$(OBJCOPY) --add-gnu-debuglink=$(LIBRARY).debuginfo $(@F) ; \
)
ifeq ($(STRIP_POLICY),all_strip)
$(STRIP) $@
else
ifeq ($(STRIP_POLICY),min_strip)
ifeq ($(PLATFORM), solaris)
$(STRIP) -x $@
else
# assume Linux
$(STRIP) -g $@
endif
# implied else here is no stripping at all
endif
endif
ifeq ($(ZIP_DEBUGINFO_FILES),1)
(set -e ; \
$(CD) $(@D) ; \
$(ZIPEXE) -q $(LIBRARY).diz $(LIBRARY).debuginfo ; \
$(RM) $(LIBRARY).debuginfo ; \
)
endif
endif # LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
endif # ENABLE_FULL_DEBUG_SYMBOLS
endif # PLATFORM-!macosx
endif # LIBRARY
endif # PLATFORM

@ -189,6 +189,15 @@ endif
$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
endif
@$(call binary_file_verification,$@)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(ZIP_DEBUGINFO_FILES),1)
(set -e ; \
$(CD) $(OBJDIR) ; \
$(ZIPEXE) -q $(PROGRAM).diz $(PROGRAM).map $(PROGRAM).pdb ; \
$(RM) $(PROGRAM).map $(PROGRAM).pdb ; \
)
endif
endif
else
#
# Note that we have to link -lthread even when USE_PTHREADS is true.
@ -232,6 +241,37 @@ else
-codesign -s openjdk_codesign $@
endif
@$(call binary_file_verification,$@)
ifneq ($(PLATFORM), macosx)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
(set -e ; \
$(CD) $(@D) ; \
$(OBJCOPY) --only-keep-debug $(@F) $(@F).debuginfo ; \
$(OBJCOPY) --add-gnu-debuglink=$(@F).debuginfo $(@F) ; \
)
ifeq ($(STRIP_POLICY),all_strip)
$(STRIP) $@
else
ifeq ($(STRIP_POLICY),min_strip)
ifeq ($(PLATFORM), solaris)
$(STRIP) -x $@
else
# assume Linux
$(STRIP) -g $@
endif
# implied else here is no stripping at all
endif
endif
ifeq ($(ZIP_DEBUGINFO_FILES),1)
(set -e ; \
$(CD) $(@D) ; \
$(ZIPEXE) -q $(@F).diz $(@F).debuginfo ; \
$(RM) $(@F).debuginfo ; \
)
endif
endif # PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS
endif # ENABLE_FULL_DEBUG_SYMBOLS
endif # PLATFORM-!macosx
endif # PLATFORM
clean::
@ -240,12 +280,16 @@ ifeq ($(PLATFORM), windows)
$(RM) $(OBJDIR)/$(PROGRAM).ico
$(RM) $(OBJDIR)/$(PROGRAM).lcf
$(RM) $(OBJDIR)/$(PROGRAM).map
$(RM) $(OBJDIR)/$(PROGRAM).pdb
$(RM) $(OBJDIR)/$(PROGRAM).exp
$(RM) $(OBJDIR)/$(PROGRAM).lib
$(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
$(RM) $(OBJDIR)/$(PROGRAM).ilk
$(RM) *.pdb
else
$(RM) $(OBJDIR)/$(PROGRAM).debuginfo
endif
$(RM) $(OBJDIR)/$(PROGRAM).diz
clobber::

@ -873,7 +873,9 @@ ifeq ($(PLATFORM), windows)
-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
else
$(FIND) $(JRE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
# The FILE command reports .debuginfo files as "ELF", but we don't want
# those files in the JRE_BIN_LIST file. EXE_SUFFIX is empty on non-Windows.
$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
endif
@ -1140,9 +1142,11 @@ ifeq ($(PLATFORM), windows)
else
$(RM) $@
$(FIND) $(JDK_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
# The FILE command reports .debuginfo files as "ELF", but we don't want
# those files in the JDK_BIN_LIST file. EXE_SUFFIX is empty on non-Windows.
$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
file `$(FIND) $(JDK_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
file `$(FIND) $(JDK_IMAGE_DIR)/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
endif

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
# Makefile for building the Java Programming Language Instrumentation Services
# agent, supporting java.lang.instrument
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
PACKAGE = sun.instrument
LIBRARY = instrument

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
LIBRARY = java_crw_demo

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
LIBRARY = hprof
PRODUCT = sun

@ -1,5 +1,5 @@
#
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PROGRAM = java
PRODUCT = java

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
PACKAGE = java.lang.management
LIBRARY = management

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
# It's currently used by jpda and hprof. Put it in base module for now.

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
# Build libverify.so
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
PRODUCT = java
LIBRARY = verify

@ -1,5 +1,5 @@
#
# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
# Makefile for building JDWP
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../..
PACKAGE = com.sun.tools.jdwp
PRODUCT = jpda

@ -1,5 +1,5 @@
#
# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
# Makefile for building the JDI back-end implementation
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
LIBRARY = dt_socket
PRODUCT = jbug

@ -27,6 +27,8 @@
# Makefile for building simple launchers
#
PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ..
PACKAGE = launcher
PRODUCT = sun

@ -1,5 +1,5 @@
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = compiledMethodLoad

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = gctest

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = heapTracker

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = heapViewer

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = hprof

@ -1,5 +1,5 @@
#
# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = minst

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = mtrace

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = versionCheck

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
# questions.
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PRODUCT = demo/jvmti
DEMONAME = waiters

@ -1,5 +1,5 @@
#
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,9 @@
#
# Makefile for building dtrace extension
#
LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
BUILDDIR = ../../..
PACKAGE = sun.tracing.dtrace
LIBRARY = jsdt