diff options
author | Lubos Lunak <l.lunak@suse.cz> | 2012-10-19 12:47:37 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-10-22 14:56:19 +0200 |
commit | a0320a908875f42bab9983ffe4db5b49fe7ba2f6 (patch) | |
tree | f873ecd25090bdaed929fb4d67e4cac09b1f118f /solenv | |
parent | 920807d4491834cd88e545fdb930c9105d58c4cd (diff) |
clean up configure options for debugging build
By default a product (non-developer) build is done. Code is optimized and no debugging
information is included (may be overriden though, see below).
Developers should preferably build with --enable-dbgutil , or at least --enable-debug.
The --enable-symbols switch has been removed. Use explicit CFLAGS/CXXFLAGS/LDFLAGS instead
if needed.
With --enable-debug optimizations are turned off and debugging information is included
(in order to make it possible to examine the code in a debugger). Additionally assertions
and logging is enabled (see SAL_WARN/SAL_INFO documentation for details and better control).
This switch should primarily by used for occassional development (such as when it is needed
to debug one module in a non-debug build, see also 'make DEBUG=true' below).
Using --enable-dbgutil is the recommended developer option. In addition to --enable-debug
it also enables additional checks, such as debugging mode for STL or checking compiler
plugins. This switch may also enable additional logging from obsolete debugging tools
(which should be converted to SAL_WARN/SAL_INFO for better control). Note that this option
makes the build binary incompatible from a --disable-dbgutil build, so it is not possible
to mix them.
When using --enable-debug/--enable-dbgutil , the build is noticeably larger because of the included
debugging information (compiler -g option). When disk space is an issue (or the computer
is not very powerful), the --enable-selective-debuginfo option allow specifying where
the debugging information should or should not be used. The option takes a list of arguments,
where all means everything, - prepended means not to enable, / appended means everything
in the directory; there is no ordering, more specific overrides more general,
and disabling takes precedence). For example, --enable-selective-debuginfo="all -sw/ -Library_sc"
enables debugginfo for everything except for anything in the sw module and the sc library.
Explicitly specified CFLAGS/CXXFLAGS/LDFLAGS override optimization and debugging options
(can be now also passed to configure which will make the build system use them).
If in a non-debug build it is needed to temporary build something as a debug build,
'make DEBUG=true' temporarily works as if --enable-debug was specified. It also temporarily
overrides debuginfo disabled using --enable-selective-debuginfo.
Old code using old logging functionality also has a concept of a debug level, forced using
'make DBGLEVEL=2'. Using a debug level of 2 (or higher) enables additional logging output.
New code should use SAL_WARN/SAL_INFO and use extra areas for additional logging output
that can be selectively enabled/disabled using SAL_LOG variable.
(Some smaller parts of this design will be implemented by separate follow-up commits.)
Change-Id: Ia6420ee3c99c217ead648e8967165eed7f632258
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 6 | ||||
-rw-r--r-- | solenv/gbuild/Module.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.help.txt | 12 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 23 | ||||
-rw-r--r-- | solenv/gbuild/platform/IOS_ARM_GCC.mk | 7 | ||||
-rw-r--r-- | solenv/gbuild/platform/WNT_INTEL_GCC.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/platform/WNT_INTEL_MSC.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/platform/macosx.mk | 7 | ||||
-rw-r--r-- | solenv/gbuild/platform/solaris.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 5 | ||||
-rw-r--r-- | solenv/inc/settings.mk | 4 |
11 files changed, 19 insertions, 64 deletions
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 870bad1fb13c..a87ecf4dbf12 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -38,12 +38,12 @@ # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined] gb_LinkTarget__debug_enabled = \ - $(and $(if $(filter -$(1),$(ENABLE_DEBUG_FOR)),,$(true)),\ + $(and $(if $(filter -$(1),$(ENABLE_DEBUGINFO_FOR)),,$(true)),\ $(or $(gb_Module_CURRENTMODULE_DEBUG_ENABLED),\ - $(filter $(1),$(ENABLE_DEBUG_FOR)))) + $(filter $(1),$(ENABLE_DEBUGINFO_FOR)))) # debug flags, if ENABLE_DEBUG is set and the LinkTarget is named -# in the list of libraries of ENABLE_DEBUG_FOR +# in the list of libraries of ENABLE_DEBUGINFO_FOR gb_LinkTarget__get_debugcflags=$(if $(call gb_LinkTarget__debug_enabled,$(1)),$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS),$(gb_COMPILEROPTFLAGS)) gb_LinkTarget__get_debugcxxflags=$(if $(call gb_LinkTarget__debug_enabled,$(1)),$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS) $(gb_DEBUG_CXXFLAGS),$(gb_COMPILEROPTFLAGS)) diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk index 17fc857e81dc..97f1a81262a0 100644 --- a/solenv/gbuild/Module.mk +++ b/solenv/gbuild/Module.mk @@ -190,8 +190,8 @@ showmodules : # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined] gb_Module__debug_enabled = \ - $(and $(if $(filter -$(1)/,$(ENABLE_DEBUG_FOR)),,$(true)),\ - $(filter all $(1)/,$(ENABLE_DEBUG_FOR))) + $(and $(if $(filter -$(1)/,$(ENABLE_DEBUGINFO_FOR)),,$(true)),\ + $(filter all $(1)/,$(ENABLE_DEBUGINFO_FOR))) define gb_Module_Module gb_Module_ALLMODULES += $(1) diff --git a/solenv/gbuild/gbuild.help.txt b/solenv/gbuild/gbuild.help.txt index b6707ebd8ff0..e2c427d4d956 100644 --- a/solenv/gbuild/gbuild.help.txt +++ b/solenv/gbuild/gbuild.help.txt @@ -48,16 +48,16 @@ AVAILABLE TARGETS environement set. (see gb_SIDE) INTERACTIVE VARIABLES: - DEBUG / debug If not empty, build with DBGLEVEL=1 (see below). - ENABLE_SYMBOLS / enable_symbols - If not empty, build with debugging information. - Automatically enabled by DEBUG/debug. + DEBUG / debug If not empty, build as with --enable-debug. DBGLEVEL / dbglevel If not empty, force the debug level to the specified value. The debug level is passed to the source code through OSL_DEBUG_LEVEL macro. - 0 = no debug - 1 = debugging information + no optimizations + 0 = no debug (as with --disable-debug) + 1 = debugging information + no optimizations (as with --enable-debug) + (Note that levels higher than 2 are used only by obsolete debugging + features. Use SAL_INFO/SAL_WARN with a specific area for extra debug + output in new code.) 2 = degugging information + no optimizations + extra debug output. OSL_TRACE starts being active on this level. diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 0f73a7422ed7..2bd196847c24 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -95,14 +95,15 @@ endif gb_DEBUGLEVEL := 0 ifneq ($(strip $(DEBUG)),) gb_DEBUGLEVEL := 1 +# make DEBUG=true should force -g ifeq ($(origin DEBUG),command line) -ENABLE_DEBUG_FOR := all +ENABLE_DEBUGINFO_FOR := all endif endif ifneq ($(strip $(debug)),) gb_DEBUGLEVEL := 1 ifeq ($(origin debug),command line) -ENABLE_DEBUG_FOR := all +ENABLE_DEBUGINFO_FOR := all endif endif ifeq ($(gb_PRODUCT),$(false)) @@ -112,27 +113,13 @@ endif ifneq ($(strip $(DBGLEVEL)),) gb_DEBUGLEVEL := $(strip $(DBGLEVEL)) ifeq ($(origin DBGLEVEL),command line) -ENABLE_DEBUG_FOR := all +ENABLE_DEBUGINFO_FOR := all endif endif ifneq ($(strip $(dbglevel)),) gb_DEBUGLEVEL := $(strip $(dbglevel)) ifeq ($(origin dbglevel),command line) -ENABLE_DEBUG_FOR := all -endif -endif - -ifeq ($(or $(ENABLE_SYMBOLS),$(enable_symbols)),FALSE) -gb_SYMBOL := $(false) -else -ifneq ($(strip $(ENABLE_SYMBOLS)$(enable_symbols)),) -gb_SYMBOL := $(true) -else -ifneq ($(gb_DEBUGLEVEL),0) -gb_SYMBOL := $(true) -else -gb_SYMBOL := $(false) -endif +ENABLE_DEBUGINFO_FOR := all endif endif diff --git a/solenv/gbuild/platform/IOS_ARM_GCC.mk b/solenv/gbuild/platform/IOS_ARM_GCC.mk index c7d40d34bed9..d0b653fd7217 100644 --- a/solenv/gbuild/platform/IOS_ARM_GCC.mk +++ b/solenv/gbuild/platform/IOS_ARM_GCC.mk @@ -132,13 +132,6 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) gb_LinkTarget_OBJCFLAGS := $(gb_CFLAGS) $(gb_OBJCFLAGS) -ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CFLAGS += -g -gb_LinkTarget_CXXFLAGS += -g -gb_LinkTarget_OBJCXXFLAGS += -g -gb_LinkTarget_OBJCFLAGS += -g -endif - define gb_LinkTarget__get_liblinkflags $(patsubst lib%.a,-l%,$(foreach lib,$(filter-out $(gb_Library_UNOLIBS_OOO),$(1)),$(call gb_Library_get_filename,$(lib)))) \ $(foreach lib,$(filter $(gb_Library_UNOLIBS_OOO),$(1)),$(SOLARVER)/$(INPATH)/lib/$(lib)$(gb_Library_UNOEXT)) diff --git a/solenv/gbuild/platform/WNT_INTEL_GCC.mk b/solenv/gbuild/platform/WNT_INTEL_GCC.mk index 46f4e70d2462..3563a6ba0d24 100644 --- a/solenv/gbuild/platform/WNT_INTEL_GCC.mk +++ b/solenv/gbuild/platform/WNT_INTEL_GCC.mk @@ -117,10 +117,7 @@ gb_STDLIBS := \ gb_LinkTarget_CFLAGS := $(gb_CFLAGS) gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) -ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CXXFLAGS += $(GGDB2) -gb_LinkTarget_CFLAGS += $(GGDB2) -endif +gb_DEBUG_CFLAGS := -g -fno-inline gb_LinkTarget_INCLUDE +=\ $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \ diff --git a/solenv/gbuild/platform/WNT_INTEL_MSC.mk b/solenv/gbuild/platform/WNT_INTEL_MSC.mk index 180cb69fc80e..4b30777606c3 100644 --- a/solenv/gbuild/platform/WNT_INTEL_MSC.mk +++ b/solenv/gbuild/platform/WNT_INTEL_MSC.mk @@ -221,11 +221,6 @@ gb_CFLAGS+=-Zi gb_CXXFLAGS+=-Zi endif -ifeq ($(gb_SYMBOL),$(true)) -gb_CFLAGS+=-Zi -gb_CXXFLAGS+=-Zi -endif - gb_COMPILEROPTFLAGS := -Ob1 -Oxs -Oy- gb_COMPILERNOOPTFLAGS := -Od diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index c013bf57ab96..a6cacc79df48 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -165,13 +165,6 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) gb_LinkTarget_OBJCFLAGS := $(gb_CFLAGS) $(gb_OBJCFLAGS) -ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CFLAGS += -g -gb_LinkTarget_CXXFLAGS += -g -gb_LinkTarget_OBJCFLAGS += -g -gb_LinkTarget_OBJCXXFLAGS += -g -endif - define gb_LinkTarget__get_layer $(if $(filter Executable,$(1)),\ $$(call gb_Executable_get_layer,$(2)),\ diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index 2abac87c6b4c..18c94e207666 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -174,11 +174,6 @@ gb_LinkTarget__RPATHS := \ gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR) -ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CXXFLAGS += -ggdb2 -gb_LinkTarget_CFLAGS += -ggdb2 -endif - # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 # we want to use @$(extraobjectlist) in the long run define gb_LinkTarget__command_dynamiclink diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 2b0612080a3b..faf494aae047 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -173,11 +173,6 @@ gb_LinkTarget__RPATHS := \ gb_LinkTarget_CFLAGS := $(gb_CFLAGS) gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) -ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CXXFLAGS += $(GGDB2) -gb_LinkTarget_CFLAGS += $(GGDB2) -endif - # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 # we want to use @$(extraobjectlist) in the long run define gb_LinkTarget__command_dynamiclink diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk index b9db9fd38b56..29e245ea800e 100644 --- a/solenv/inc/settings.mk +++ b/solenv/inc/settings.mk @@ -1040,14 +1040,14 @@ CDEFS+= -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) CDEFS+= -DSUPD=$(UPD) # flags to enable build with symbols; required for crashdump feature -.IF ("$(ENABLE_CRASHDUMP)"!="" && "$(ENABLE_CRASHDUMP)"!="DUMMY") || ("$(ENABLE_SYMBOLS)"!="" && "$(ENABLE_SYMBOLS)"!="FALSE") +.IF ("$(ENABLE_CRASHDUMP)"!="" && "$(ENABLE_CRASHDUMP)"!="DUMMY") || ("$(ENABLE_DEBUG)"!="" && "$(ENABLE_DEBUG)"!="FALSE") # if debug is enabled, this may enable less debug info than debug, so rely just on debug .IF "$(debug)" == "" CFLAGSENABLESYMBOLS_CC_ONLY*=$(CFLAGSENABLESYMBOLS) CFLAGSCXX+=$(CFLAGSENABLESYMBOLS) CFLAGSCC+=$(CFLAGSENABLESYMBOLS_CC_ONLY) .ENDIF # "$(DEBUG)" == "" -.ENDIF # ("$(ENABLE_CRASHDUMP)"!="" && "$(ENABLE_CRASHDUMP)"!="DUMMY") || "$(ENABLE_SYMBOLS)"!="" +.ENDIF # ("$(ENABLE_CRASHDUMP)"!="" && "$(ENABLE_CRASHDUMP)"!="DUMMY") || "$(ENABLE_DEBUG)"!="" .IF "$(profile)"!="" CDEFS+= $(CDEFSPROF) |