Bug 575179 Port |Bug 517097 - make enabling debug symbols more sane| to comm-central. r=Callek
authorTakanori MATSUURA <t.matsuu@gmail.com>
Fri, 23 Jul 2010 09:02:04 +0100
changeset 5995 5935be13433fd9f2163349ead72e682f64d79141
parent 5994 4472ff8be2333ec21f5675affa69949d5d0b1940
child 5996 a8edda118d972768f3dfb7a0382caae13f1957b1
push idunknown
push userunknown
push dateunknown
reviewersCallek
bugs575179, 517097
Bug 575179 Port |Bug 517097 - make enabling debug symbols more sane| to comm-central. r=Callek
config/autoconf.mk.in
config/config.mk
configure.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -85,23 +85,22 @@ MOZ_CHROME_FILE_FORMAT	= @MOZ_CHROME_FIL
 
 MOZ_WIDGET_TOOLKIT	= @MOZ_WIDGET_TOOLKIT@
 MOZ_DFB			= @MOZ_DFB@
 MOZ_X11			= @MOZ_X11@
 
 MOZ_JS_LIBS		   = @MOZ_JS_LIBS@
 
 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_JSDEBUGGER  = @MOZ_JSDEBUGGER@
 MOZ_IPC 	= @MOZ_IPC@
 MOZ_MEMORY      = @MOZ_MEMORY@
 MOZ_JPROF       = @MOZ_JPROF@
 MOZ_SHARK       = @MOZ_SHARK@
 DEHYDRA_PATH    = @DEHYDRA_PATH@
 
 ENABLE_EAZEL_PROFILER=@ENABLE_EAZEL_PROFILER@
@@ -504,17 +503,16 @@ USE_GSSAPI	= @USE_GSSAPI@
 
 MAIL_PKG_SHARED = @MAIL_PKG_SHARED@
 
 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@
 WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
 MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
 
 # This is for custom CRT building
 ifdef MOZ_MEMORY
--- a/config/config.mk
+++ b/config/config.mk
@@ -161,91 +161,31 @@ ifneq (,$(filter-out WINNT WINCE,$(OS_AR
 JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_MOZLIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
 endif
 endif
 
 # determine debug-related options
 _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
-  ifeq ($(first_match), ^$(MODULE))
-    # the user specified explicitly that this module 
-    # should not be compiled with -g (nothing to do)
-  else
-    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)      
-    else
-      ifeq ($(first_match), ^ALL_MODULES)
-        # the user didn't mention this module explicitly, 
-        # but wanted all modules to be compiled without -g (nothing to do)
-      endif
-    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)
 
 # XXX: What does this? Bug 482434 filed for better explanation.
 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
 ifdef MOZ_DEBUG
 ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
--- a/configure.in
+++ b/configure.in
@@ -2039,30 +2039,26 @@ ia64*-hpux*)
 
 *-*linux*)
     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
     # Similarly for GNU_CXX and INTEL_CXX.
     if test "$INTEL_CC" || test "$INTEL_CXX"; then
         # -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
         4.1.*|4.2.*)
             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
         esac
         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $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\"'
 
     MOZ_MEMORY=1
 
     case "${target_cpu}" in
     alpha*)
@@ -4498,17 +4494,16 @@ dnl ====================================
 
 MOZ_ARG_HEADER(Application)
 
 BUILD_STATIC_LIBS=
 ENABLE_TESTS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_CALENDAR=
-MOZ_DBGRINFO_MODULES=
 MOZ_FEEDS=1
 MOZ_IPC=1
 MOZ_JSDEBUGGER=1
 MOZ_JSLOADER=1
 MOZ_LDAP_XPCOM=
 MOZ_MAIL_NEWS=
 MOZ_MORK=
 MOZ_MORKREADER=1
@@ -5755,21 +5750,22 @@ then
     *)
     	MOZ_DEBUG_FLAGS="-g"
         ;;
     esac
 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=
   fi ],
   MOZ_DEBUG=)
   
 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
 MOZ_ARG_WITH_STRING(debug-label,
@@ -5846,43 +5842,47 @@ fi
 fi # COMPILE_ENVIRONMENT
 
 AC_SUBST(MOZ_OPTIMIZE)
 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
 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 garbage collector
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(boehm,
 [  --enable-boehm          Enable the Boehm Garbage Collector],
     GC_LEAK_DETECTOR=1,
     GC_LEAK_DETECTOR= )
@@ -6967,24 +6967,23 @@ AC_SUBST(MOZ_PERMISSIONS)
 AC_SUBST(MOZ_XTF)
 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
 AC_SUBST(MOZ_PREF_EXTENSIONS)
 AC_SUBST(MOZ_SMIL)
 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_PROFILE_MODULES)
 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_JSDEBUGGER)
 AC_SUBST(MOZ_PLUGINS)
 AC_SUBST(ENABLE_EAZEL_PROFILER)
 AC_SUBST(EAZEL_PROFILER_CFLAGS)
 AC_SUBST(EAZEL_PROFILER_LIBS)
 AC_SUBST(GC_LEAK_DETECTOR)
 AC_SUBST(MOZ_LOG_REFCNT)
 AC_SUBST(MOZ_JPROF)
@@ -7053,17 +7052,16 @@ AC_SUBST(SEAMONKEY_VERSION)
 
 AC_SUBST(MOZ_PKG_SPECIAL)
 
 AC_SUBST(MAIL_PKG_SHARED)
 
 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)
 AC_SUBST(CYGWIN_WRAPPER)
 AC_SUBST(AS_PERL)
 AC_SUBST(WIN32_REDIST_DIR)
 AC_SUBST(PYTHON)
 AC_SUBST(MAKENSISU)