From f7fff5fc635f9f3072dad53447fbd792d034cc82 Mon Sep 17 00:00:00 2001 From: Mitchell Field Date: Tue, 2 Mar 2010 06:24:00 -0500 Subject: [PATCH] bug 517097 - make enabling debug symbols more sane r=ted --HG-- extra : rebase_source : 7abb0297202f10afe80c5a74e47899b4762095a2 --- config/autoconf.mk.in | 4 +-- config/config.mk | 62 +++------------------------------ configure.in | 66 +++++++++++++++++------------------- js/src/config/autoconf.mk.in | 4 +-- js/src/config/config.mk | 62 +++------------------------------ js/src/configure.in | 64 +++++++++++++++++----------------- 6 files changed, 75 insertions(+), 187 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 3fada6ac6b2..9b589ee66b4 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -92,12 +92,11 @@ MOZ_PANGO = @MOZ_PANGO@ MOZ_JS_LIBS = @MOZ_JS_LIBS@ MOZ_DEBUG = @MOZ_DEBUG@ -MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@ +MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@ MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@ MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@ MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@ -MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@ MOZ_EXTENSIONS = @MOZ_EXTENSIONS@ MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@ MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@ @@ -591,7 +590,6 @@ MOZILLA_OFFICIAL = @MOZILLA_OFFICIAL@ # Win32 options MOZ_BROWSE_INFO = @MOZ_BROWSE_INFO@ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@ -MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ MOZ_QUANTIFY = @MOZ_QUANTIFY@ MSMANIFEST_TOOL = @MSMANIFEST_TOOL@ WIN32_REDIST_DIR = @WIN32_REDIST_DIR@ diff --git a/config/config.mk b/config/config.mk index 3a3f6179353..1b3c5fd985b 100644 --- a/config/config.mk +++ b/config/config.mk @@ -162,73 +162,21 @@ endif _DEBUG_CFLAGS := _DEBUG_LDFLAGS := -ifndef MOZ_DEBUG - # global debugging is disabled - # check if it was explicitly enabled for this module - ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES))) - MOZ_DEBUG:=1 - endif -else - # global debugging is enabled - # check if it was explicitly disabled for this module - ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES))) - MOZ_DEBUG:= - endif -endif - ifdef MOZ_DEBUG - _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) + _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) else _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) -endif - -# determine if -g should be passed to the compiler, based on -# the current module, and the value of MOZ_DBGRINFO_MODULES - -ifdef MOZ_DEBUG - MOZ_DBGRINFO_MODULES += ALL_MODULES - pattern := ALL_MODULES ^ALL_MODULES -else - MOZ_DBGRINFO_MODULES += ^ALL_MODULES - pattern := ALL_MODULES ^ALL_MODULES -endif - -ifdef MODULE - # our current Makefile specifies a module name - add it to our pattern - pattern += $(MODULE) ^$(MODULE) -endif - -# start by finding the first relevant module name -# (remember that the order of the module names in MOZ_DBGRINFO_MODULES -# is reversed from the order the user specified to configure - -# this allows the user to put general names at the beginning -# of the list, and to override them with explicit module names later -# in the list) - -first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES))) - -ifeq ($(first_match), $(MODULE)) - # the user specified explicitly that - # this module should be compiled with -g - _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) - _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) -else - ifneq ($(first_match), ^$(MODULE)) - ifeq ($(first_match), ALL_MODULES) - # the user didn't mention this module explicitly, - # but wanted all modules to be compiled with -g - _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) - _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) - endif + ifdef MOZ_DEBUG_SYMBOLS + _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) endif endif MOZALLOC_LIB = $(call EXPAND_MOZLIBNAME,mozalloc) -# append debug flags -# (these might have been above when processing MOZ_DBGRINFO_MODULES) OS_CFLAGS += $(_DEBUG_CFLAGS) OS_CXXFLAGS += $(_DEBUG_CFLAGS) OS_LDFLAGS += $(_DEBUG_LDFLAGS) diff --git a/configure.in b/configure.in index d9d1d23b96c..c942572bed8 100644 --- a/configure.in +++ b/configure.in @@ -2016,7 +2016,7 @@ case "$target" in # -Os has been broken on Intel's C/C++ compilers for quite a # while; Intel recommends against using it. MOZ_OPTIMIZE_FLAGS="-O2" - MOZ_DEBUG_FLAGS="-g -fno-inline" + MOZ_DEBUG_FLAGS="-g" elif test "$GNU_CC" || test "$GNU_CXX"; then GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'` case $GCC_VERSION in @@ -2025,11 +2025,7 @@ case "$target" in MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" esac MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK" - MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, - # and that combo is not yet good at - # debugging inlined functions (even - # when using DWARF2 as the debugging - # format) + MOZ_DEBUG_FLAGS="-g" fi TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' @@ -4695,7 +4691,6 @@ ENABLE_TESTS=1 MOZ_ACTIVEX_SCRIPTING_SUPPORT= MOZ_BRANDING_DIRECTORY= MOZ_OFFICIAL_BRANDING= -MOZ_DBGRINFO_MODULES= MOZ_FEEDS=1 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon" MOZ_IMG_ENCODERS_DEFAULT="png jpeg" @@ -6642,11 +6637,12 @@ fi MOZ_ARG_ENABLE_STRING(debug, [ --enable-debug[=DBG] Enable building with developer debug info - (Using compiler flags DBG)], + (using compiler flags DBG)], [ if test "$enableval" != "no"; then MOZ_DEBUG=1 - if test -n "$enableval" && test "$enableval" != "yes"; then + if test -n "$enableval" -a "$enableval" != "yes"; then MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _MOZ_DEBUG_FLAGS_SET=1 fi else MOZ_DEBUG= @@ -6740,33 +6736,37 @@ AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) dnl ======================================================== -dnl = Enable/disable debug for specific modules only -dnl = module names beginning with ^ will be disabled -dnl ======================================================== -MOZ_ARG_ENABLE_STRING(debug-modules, -[ --enable-debug-modules Enable/disable debug info for specific modules], -[ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] ) - -dnl ======================================================== -dnl = Enable/disable generation of debugger info for specific modules only -dnl = the special module name ALL_MODULES can be used to denote all modules -dnl = module names beginning with ^ will be disabled +dnl = (Deprecated) generation of debugger info for specific modules dnl ======================================================== MOZ_ARG_ENABLE_STRING(debugger-info-modules, [ --enable-debugger-info-modules Enable/disable debugger info for specific modules], -[ for i in `echo $enableval | sed 's/,/ /g'`; do - dnl note that the list of module names is reversed as it is copied - dnl this is important, as it will allow config.mk to interpret stuff like - dnl "^ALL_MODULES xpcom" properly - if test "$i" = "no"; then - i="^ALL_MODULES" +[ if test "$enableval" != "no"; then + AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead]) + MOZ_DEBUG_SYMBOLS=1 + fi ]) + +dnl ======================================================== +dnl = Enable generation of debug symbols +dnl ======================================================== +MOZ_ARG_ENABLE_STRING(debug-symbols, +[ --enable-debug-symbols[=DBG] Enable debugging symbols + (using compiler flags DBG)], +[ if test "$enableval" != "no"; then + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + if test -z "$_MOZ_DEBUG_FLAGS_SET"; then + MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + else + AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags]) + fi fi - if test "$i" = "yes"; then - i="ALL_MODULES" - fi - MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES"; - done ]) + fi ]) + +if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then + AC_DEFINE(MOZ_DEBUG_SYMBOLS) + export MOZ_DEBUG_SYMBOLS +fi dnl ======================================================== dnl Disable runtime logging checks @@ -8173,13 +8173,12 @@ AC_SUBST(MOZ_XSLT_STANDALONE) AC_SUBST(MOZ_JS_LIBS) AC_SUBST(MOZ_PSM) AC_SUBST(MOZ_DEBUG) -AC_SUBST(MOZ_DEBUG_MODULES) +AC_SUBST(MOZ_DEBUG_SYMBOLS) AC_SUBST(MOZ_DEBUG_ENABLE_DEFS) AC_SUBST(MOZ_DEBUG_DISABLE_DEFS) AC_SUBST(MOZ_DEBUG_FLAGS) AC_SUBST(MOZ_DEBUG_LDFLAGS) AC_SUBST(WARNINGS_AS_ERRORS) -AC_SUBST(MOZ_DBGRINFO_MODULES) AC_SUBST(MOZ_EXTENSIONS) AC_SUBST(MOZ_IMG_DECODERS) AC_SUBST(MOZ_IMG_ENCODERS) @@ -8268,7 +8267,6 @@ AC_SUBST(MOZ_PKG_SPECIAL) AC_SUBST(MOZILLA_OFFICIAL) dnl win32 options -AC_SUBST(MOZ_DEBUG_SYMBOLS) AC_SUBST(MOZ_MAPINFO) AC_SUBST(MOZ_BROWSE_INFO) AC_SUBST(MOZ_TOOLS_DIR) diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 184d5923216..115fd6d4de4 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -76,13 +76,12 @@ MOZ_JS_LIBS = @MOZ_JS_LIBS@ MOZ_SYNC_BUILD_FILES = @MOZ_SYNC_BUILD_FILES@ MOZ_DEBUG = @MOZ_DEBUG@ -MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@ +MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@ MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@ MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@ MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@ MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@ -MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@ MOZ_EXTENSIONS = @MOZ_EXTENSIONS@ MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@ MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@ @@ -317,7 +316,6 @@ MOZILLA_OFFICIAL = @MOZILLA_OFFICIAL@ # Win32 options MOZ_BROWSE_INFO = @MOZ_BROWSE_INFO@ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@ -MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ MOZ_QUANTIFY = @MOZ_QUANTIFY@ MSMANIFEST_TOOL = @MSMANIFEST_TOOL@ WIN32_REDIST_DIR = @WIN32_REDIST_DIR@ diff --git a/js/src/config/config.mk b/js/src/config/config.mk index 3a3f6179353..1b3c5fd985b 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -162,73 +162,21 @@ endif _DEBUG_CFLAGS := _DEBUG_LDFLAGS := -ifndef MOZ_DEBUG - # global debugging is disabled - # check if it was explicitly enabled for this module - ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES))) - MOZ_DEBUG:=1 - endif -else - # global debugging is enabled - # check if it was explicitly disabled for this module - ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES))) - MOZ_DEBUG:= - endif -endif - ifdef MOZ_DEBUG - _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) + _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) else _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS) -endif - -# determine if -g should be passed to the compiler, based on -# the current module, and the value of MOZ_DBGRINFO_MODULES - -ifdef MOZ_DEBUG - MOZ_DBGRINFO_MODULES += ALL_MODULES - pattern := ALL_MODULES ^ALL_MODULES -else - MOZ_DBGRINFO_MODULES += ^ALL_MODULES - pattern := ALL_MODULES ^ALL_MODULES -endif - -ifdef MODULE - # our current Makefile specifies a module name - add it to our pattern - pattern += $(MODULE) ^$(MODULE) -endif - -# start by finding the first relevant module name -# (remember that the order of the module names in MOZ_DBGRINFO_MODULES -# is reversed from the order the user specified to configure - -# this allows the user to put general names at the beginning -# of the list, and to override them with explicit module names later -# in the list) - -first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES))) - -ifeq ($(first_match), $(MODULE)) - # the user specified explicitly that - # this module should be compiled with -g - _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) - _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) -else - ifneq ($(first_match), ^$(MODULE)) - ifeq ($(first_match), ALL_MODULES) - # the user didn't mention this module explicitly, - # but wanted all modules to be compiled with -g - _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) - _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) - endif + ifdef MOZ_DEBUG_SYMBOLS + _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) + _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) endif endif MOZALLOC_LIB = $(call EXPAND_MOZLIBNAME,mozalloc) -# append debug flags -# (these might have been above when processing MOZ_DBGRINFO_MODULES) OS_CFLAGS += $(_DEBUG_CFLAGS) OS_CXXFLAGS += $(_DEBUG_CFLAGS) OS_LDFLAGS += $(_DEBUG_LDFLAGS) diff --git a/js/src/configure.in b/js/src/configure.in index cd684f56ffb..f5350af9a50 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1793,7 +1793,7 @@ case "$target" in # -Os has been broken on Intel's C/C++ compilers for quite a # while; Intel recommends against using it. MOZ_OPTIMIZE_FLAGS="-O2" - MOZ_DEBUG_FLAGS="-g -fno-inline" + MOZ_DEBUG_FLAGS="-g" elif test "$GNU_CXX"; then GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'` case $GCC_VERSION in @@ -1802,11 +1802,7 @@ case "$target" in MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" esac MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK" - MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, - # and that combo is not yet good at - # debugging inlined functions (even - # when using DWARF2 as the debugging - # format) + MOZ_DEBUG_FLAGS="-g" fi TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' @@ -3912,7 +3908,6 @@ MOZ_ARG_HEADER(Application) BUILD_STATIC_LIBS= ENABLE_TESTS=1 -MOZ_DBGRINFO_MODULES= dnl ======================================================== dnl = @@ -3985,8 +3980,9 @@ MOZ_ARG_ENABLE_STRING(debug, (Using compiler flags DBG)], [ if test "$enableval" != "no"; then MOZ_DEBUG=1 - if test -n "$enableval" && test "$enableval" != "yes"; then + if test -n "$enableval" -a "$enableval" != "yes"; then MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _MOZ_DEBUG_FLAGS_SET=1 fi else MOZ_DEBUG= @@ -4067,33 +4063,37 @@ AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) dnl ======================================================== -dnl = Enable/disable debug for specific modules only -dnl = module names beginning with ^ will be disabled -dnl ======================================================== -MOZ_ARG_ENABLE_STRING(debug-modules, -[ --enable-debug-modules Enable/disable debug info for specific modules], -[ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] ) - -dnl ======================================================== -dnl = Enable/disable generation of debugger info for specific modules only -dnl = the special module name ALL_MODULES can be used to denote all modules -dnl = module names beginning with ^ will be disabled +dnl = (Deprecated) generation of debugger info for specific modules dnl ======================================================== MOZ_ARG_ENABLE_STRING(debugger-info-modules, [ --enable-debugger-info-modules Enable/disable debugger info for specific modules], -[ for i in `echo $enableval | sed 's/,/ /g'`; do - dnl note that the list of module names is reversed as it is copied - dnl this is important, as it will allow config.mk to interpret stuff like - dnl "^ALL_MODULES xpcom" properly - if test "$i" = "no"; then - i="^ALL_MODULES" +[ if test "$enableval" != "no"; then + AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead]) + MOZ_DEBUG_SYMBOLS=1 + fi ]) + +dnl ======================================================== +dnl = Enable generation of debug symbols +dnl ======================================================== +MOZ_ARG_ENABLE_STRING(debug-symbols, +[ --enable-debug-symbols[=DBG] Enable debugging symbols + (using compiler flags DBG)], +[ if test "$enableval" != "no"; then + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + if test -z "$_MOZ_DEBUG_FLAGS_SET"; then + MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + else + AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags]) + fi fi - if test "$i" = "yes"; then - i="ALL_MODULES" - fi - MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES"; - done ]) + fi ]) + +if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then + AC_DEFINE(MOZ_DEBUG_SYMBOLS) + export MOZ_DEBUG_SYMBOLS +fi dnl ======================================================== dnl Enable Narcissus @@ -4873,13 +4873,12 @@ AC_SUBST(NS_USE_NATIVE) AC_SUBST(MOZ_JS_LIBS) AC_SUBST(MOZ_PSM) AC_SUBST(MOZ_DEBUG) -AC_SUBST(MOZ_DEBUG_MODULES) +AC_SUBST(MOZ_DEBUG_SYMBOLS) AC_SUBST(MOZ_DEBUG_ENABLE_DEFS) AC_SUBST(MOZ_DEBUG_DISABLE_DEFS) AC_SUBST(MOZ_DEBUG_FLAGS) AC_SUBST(MOZ_DEBUG_LDFLAGS) AC_SUBST(WARNINGS_AS_ERRORS) -AC_SUBST(MOZ_DBGRINFO_MODULES) AC_SUBST(MOZ_LEAKY) AC_SUBST(MOZ_JPROF) AC_SUBST(MOZ_SHARK) @@ -4926,7 +4925,6 @@ AC_SUBST(MOZ_PKG_SPECIAL) AC_SUBST(MOZILLA_OFFICIAL) dnl win32 options -AC_SUBST(MOZ_DEBUG_SYMBOLS) AC_SUBST(MOZ_MAPINFO) AC_SUBST(MOZ_BROWSE_INFO) AC_SUBST(MOZ_TOOLS_DIR)