Kaydet (Commit) a0320a90 authored tarafından Lubos Lunak's avatar Lubos Lunak Kaydeden (comit) Luboš Luňák

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
üst 920807d4
......@@ -123,7 +123,9 @@ export ENABLE_CRASHDUMP=@ENABLE_CRASHDUMP@
export ENABLE_CUPS=@ENABLE_CUPS@
export ENABLE_DBUS=@ENABLE_DBUS@
export ENABLE_PACKAGEKIT=@ENABLE_PACKAGEKIT@
export ENABLE_DEBUG_FOR=@ENABLE_DEBUG_FOR@
export ENABLE_DBGUTIL=@ENABLE_DBGUTIL@
export ENABLE_DEBUG=@ENABLE_DEBUG@
export ENABLE_DEBUGINFO_FOR=@ENABLE_DEBUGINFO_FOR@
export ENABLE_DIRECTX=@ENABLE_DIRECTX@
export ENABLE_EVOAB2=@ENABLE_EVOAB2@
export ENABLE_GCONF=@ENABLE_GCONF@
......@@ -166,7 +168,6 @@ export ENABLE_SCRIPTING_BEANSHELL=@ENABLE_SCRIPTING_BEANSHELL@
export ENABLE_SCRIPTING_JAVASCRIPT=@ENABLE_SCRIPTING_JAVASCRIPT@
export ENABLE_SCRIPTING_PYTHON=@ENABLE_SCRIPTING_PYTHON@
export ENABLE_SILENT_MSI=@ENABLE_SILENT_MSI@
export ENABLE_SYMBOLS=@ENABLE_SYMBOLS@
export ENABLE_SYSTRAY_GTK=@ENABLE_SYSTRAY_GTK@
export ENABLE_TELEPATHY=@ENABLE_TELEPATHY@
export ENABLE_ZENITY=@ENABLE_ZENITY@
......
......@@ -752,13 +752,6 @@ AC_ARG_ENABLE(atl,
],
,)
AC_ARG_ENABLE(symbols,
AS_HELP_STRING([--enable-symbols],
[Include debugging information in output ("symbols" is misleading here;
enables -g compiler option or equivalent). WARNING: A complete build
needs a lot of space (roughly 10 GiB) and takes much longer.]),
,)
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
[Turn warnings to errors. (Has no effect in modules where the treating
......@@ -772,25 +765,26 @@ AC_ARG_ENABLE(assert-always-abort,
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[Include debugging information like with --enable-symbols, disable
compiler optimization and inlining plus extra debugging code like
assertions. Extra large build! (enables -g compiler flag and dmake
debug=true) If you need even more verbose output, build a module with
"build -- debug=true dbglevel=2".
You can also use this switch as follows:
--enable-debug="all -sw/ -Library_sc" to enable debugging only for
the specified gbuild-build targets (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).]))
[Include debugging information, disable compiler optimization and inlining plus
extra debugging code like assertions. Extra large build! (enables -g compiler flag
and dmake debug=true).]))
AC_ARG_ENABLE(dbgutil,
AS_HELP_STRING([--enable-dbgutil],
[Include additional debugging utilities, such as assertions, object
counting, etc. Larger build. Independent from --enable-debug.
Note that this option makes the build ABI incompatible:
It is not possible to mix object files or libraries from a
--enable-dbgutil and a --disable-dbgutil build.]))
[Provide debugging support from --enable-debug and include additional debugging
utilities such as object counting or more expensive checks.
This is the recommended option for developers.
Note that this makes the build ABI incompatible, it is not possible to mix object
files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
AC_ARG_ENABLE(selective-debuginfo,
AS_HELP_STRING([--enable-selective-debuginfo],
[If --enable-debug or --enable-dbgutil is used, build debugging information
(-g compiler flag) only for the specified gbuild build targets
(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).
Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
AC_ARG_ENABLE(compiler-plugins,
AS_HELP_STRING([--enable-compiler-plugins],
......@@ -3069,38 +3063,6 @@ printf ("hello world\n");
fi
AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
dnl Set the ENABLE_DBGUTIL variable
dnl ===================================================================
AC_MSG_CHECKING([whether to build with additional debug utilities])
if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
PROEXT=""
PRODUCT=""
AC_MSG_RESULT([yes])
# cppunit and graphite expose STL in public headers
if test "$with_system_cppunit" = "yes"; then
AC_MSG_ERROR([--with-system-cppunit conflicts with DBG_UTIL build])
else
with_system_cppunit=no
fi
if test "$with_system_graphite" = "yes"; then
AC_MSG_ERROR([--with-system-graphite conflicts with DBG_UTIL build])
else
with_system_graphite=no
fi
if test "$with_system_mysql_cppconn" = "yes"; then
AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with DBG_UTIL build])
else
with_system_mysql_cppconn=no
fi
else
PRODUCT="full"
PROEXT=".pro"
AC_MSG_RESULT([no, full product build])
fi
AC_SUBST(PRODUCT)
AC_SUBST(PROEXT)
dnl ===================================================================
dnl Check which Microsoft C/C++ or MinGW compiler is used for WINNT
dnl ===================================================================
......@@ -4204,27 +4166,70 @@ else
fi
AC_SUBST(ASSERT_ALWAYS_ABORT)
dnl Set the ENABLE_DEBUG variable.
dnl Set the ENABLE_DBGUTIL variable
dnl ===================================================================
AC_MSG_CHECKING([whether to do a debug build])
if test -n "$enable_debug" && test "$enable_debug" != "no"; then
if test "$enable_debug" = "y" || test "$enable_debug" = "yes"; then
ENABLE_DEBUG="TRUE"
ENABLE_DEBUG_FOR=all
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([whether to build with additional debug utilities])
if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
ENABLE_DBGUTIL="TRUE"
PROEXT=""
PRODUCT=""
AC_MSG_RESULT([yes])
# cppunit and graphite expose STL in public headers
if test "$with_system_cppunit" = "yes"; then
AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
else
ENABLE_DEBUG=""
ENABLE_DEBUG_FOR="$enable_debug"
AC_MSG_RESULT([for $enable_debug])
with_system_cppunit=no
fi
if test "$with_system_graphite" = "yes"; then
AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
else
with_system_graphite=no
fi
if test "$with_system_mysql_cppconn" = "yes"; then
AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
else
with_system_mysql_cppconn=no
fi
else
ENABLE_DBGUTIL=""
# PRODUCT is old concept, still used by build.pl .
PRODUCT="full"
PROEXT=".pro"
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_DBGUTIL)
AC_SUBST(PRODUCT)
AC_SUBST(PROEXT)
dnl Set the ENABLE_DEBUG variable.
dnl ===================================================================
AC_MSG_CHECKING([whether to do a debug build])
if test -n "$ENABLE_DBGUTIL"; then
ENABLE_DEBUG="TRUE"
AC_MSG_RESULT([yes (dbgutil)])
elif test -n "$enable_debug" && test "$enable_debug" != "no"; then
ENABLE_DEBUG="TRUE"
AC_MSG_RESULT([yes])
else
ENABLE_DEBUG=""
ENABLE_DEBUG_FOR=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_DEBUG)
AC_SUBST(ENABLE_DEBUG_FOR)
dnl Selective debuginfo
ENABLE_DEBUGINFO_FOR=
if test -n "$ENABLE_DEBUG"; then
AC_MSG_CHECKING([whether to use selective debuginfo])
if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
AC_MSG_RESULT([for "$enable_selective_debuginfo"])
else
ENABLE_DEBUGINFO_FOR=all
AC_MSG_RESULT([no, for all])
fi
fi
AC_SUBST(ENABLE_DEBUGINFO_FOR)
dnl Determine whether to use linkoo for the smoketest installation
dnl ===================================================================
......@@ -4250,22 +4255,6 @@ else
fi
AC_SUBST(ENABLE_LTO)
dnl whether to include debgugging information into final build.
dnl ===================================================================
AC_MSG_CHECKING([whether to include debugging information])
if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
ENABLE_SYMBOLS="TRUE"
AC_MSG_RESULT([yes])
else
if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
ENABLE_SYMBOLS="FALSE"
else
ENABLE_SYMBOLS=
fi
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_SYMBOLS)
if test "$enable_headless" = "yes"; then
# be sure to do not mess with uneeded stuff
test_randr=no
......
......@@ -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))
......
......@@ -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)
......
......@@ -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.
......
......@@ -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
......
......@@ -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))
......
......@@ -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)) \
......
......@@ -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
......
......@@ -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)),\
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment