Module: xenomai-forge
Branch: master
Commit: 2b6326701c2261ab42e3203a29782ad8905f0665
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=2b6326701c2261ab42e3203a29782ad8905f0665

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Jul  7 18:43:15 2013 +0200

build: introduce symbols-only debug level

--enable-debug[=partial]

"symbols" enables debug symbols to be compiled in the libraries and
executables, still turning on the optimizer (-O2). This option has no
overhead, it is useful to get meaningful backtraces using gdb while
running the application at nominal speed.

"partial" includes "symbols", and also turns on internal consistency
checks within the Xenomai code (mostly present in the Copperplate
layer). The __XENO_DEBUG__ macro is defined, for both the Xenomai core
and the applications getting their C compilation flags from the
xeno-config script (i.e. xeno-config --cflags). The partial debug mode
implicitly turns on --enable-assert. A measurable overhead is
introduced by this level.  This is the default level when
--enable-debug is mentioned with no level specification.

"full" includes "partial" settings, but the optimizer is disabled
(-O0), and even more consistency checks may be performed.  In addition
to __XENO_DEBUG__, the macro __XENO_DEBUG_FULL__ is defined. This
level introduces the most overhead, which may triple the worst-case
latency, or even more.

---

 README       |   50 ++++++++++++++++++++++++++++++++++----------------
 configure    |   26 ++++++++++++++++++++++----
 configure.in |   28 +++++++++++++++++++++++-----
 3 files changed, 79 insertions(+), 25 deletions(-)

diff --git a/README b/README
index 17852e7..8185280 100644
--- a/README
+++ b/README
@@ -93,25 +93,43 @@ Where <other-options> may be any standard autoconf switch, 
such as:
 
 or Xenomai-specific knobs:
 
---enable-debug[=full]
+--enable-debug[=partial]
 
-       This switch will enable debug mode, causing debug symbols to
-       be compiled in the libraries and executables, passing the -g
-       flag to the compiler to get debug symbols. When enabled, this
-       switch also causes the __XENO_DEBUG__ macro to be defined, for
-       both the Xenomai core and the applications getting their C
-       compilation flags from the xeno-config script
-       (i.e. xeno-config --cflags).  Debug mode is off by default.
+       This switch controls the debug level. Three levels are
+       available, with varying overhead:
 
-       If the full debug level is specified along with this switch,
-       -O0 is passed to the compiler, to disable the optimizer. In
-       addition, the macro __XENO_DEBUG_FULL__ is also defined.
+       "symbols" enables debug symbols to be compiled in the
+       libraries and executables, still turning on the optimizer
+       (-O2). This option has no overhead, it is useful to get
+       meaningful backtraces using gdb while running the application
+       at nominal speed.
 
-       Over the Mercury core, enabling debug mode also causes the
-       standard malloc interface to be used internally instead of a
-       fast real-time allocator (TLSF). This allows debugging
-       memory-related issues with the help of Valgrind or other
-       dynamic memory analysers.
+       "partial" includes "symbols", and also turns on internal
+       consistency checks within the Xenomai code (mostly present in
+       the Copperplate layer). The __XENO_DEBUG__ macro is defined,
+       for both the Xenomai core and the applications getting their C
+       compilation flags from the xeno-config script
+       (i.e. xeno-config --cflags). The partial debug mode implicitly
+       turns on --enable-assert. A measurable overhead is introduced
+       by this level.  This is the default level when --enable-debug
+       is mentioned with no level specification.
+
+       "full" includes "partial" settings, but the optimizer is
+       disabled (-O0), and even more consistency checks may be
+       performed.  In addition to __XENO_DEBUG__, the macro
+       __XENO_DEBUG_FULL__ is defined. This level introduces the most
+       overhead, which may triple the worst-case latency, or even
+       more.
+
+       Over the Mercury core, enabling "partial" or "full" debug
+       modes also causes the standard malloc interface to be used
+       internally instead of a fast real-time allocator (TLSF). This
+       allows debugging memory-related issues with the help of
+       Valgrind or other dynamic memory analysers.
+
+       --disable-debug fully turns off all consistency checks and
+          assertions, turns on the optimizer and disables debug symbol
+          generation.
 
 --enable-assert
 
diff --git a/configure b/configure
index c4580df..d936571 100755
--- a/configure
+++ b/configure
@@ -12656,14 +12656,30 @@ CC="$lt_save_CC"
 
 
 debug_mode=
+debug_symbols=
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debug 
mode" >&5
 $as_echo_n "checking whether to enable debug mode... " >&6; }
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug; case "$enableval" in
-       y | yes | partial) debug_mode=partial ;;
-       full)    debug_mode=full ;;
-       *) unset debug_mode ;;
+       symbols)
+               debug_symbols=y
+               ;;
+       y | yes | partial)
+               debug_mode=partial
+               debug_symbols=y
+               ;;
+       full)
+               debug_mode=full
+               debug_symbols=y
+               ;;
+       n | no)
+               debug_mode=
+               debug_symbols=
+               ;;
+       *)
+                as_fn_error $? "invalid debug level $enableval" "$LINENO" 5
+                ;;
        esac
 fi
 
@@ -13847,7 +13863,9 @@ XENO_USER_APP_LDFLAGS=$XENO_USER_LDADD
 if test x$debug_mode = xpartial; then
    XENO_USER_CFLAGS="-g -O2 -D__XENO_DEBUG__ $XENO_USER_CFLAGS"
 elif test x$debug_mode = xfull; then
-   XENO_USER_CFLAGS="-g -D__XENO_DEBUG__ -D__XENO_DEBUG_FULL__ 
$XENO_USER_CFLAGS"
+   XENO_USER_CFLAGS="-g -O0 -D__XENO_DEBUG__ -D__XENO_DEBUG_FULL__ 
$XENO_USER_CFLAGS"
+elif test x$debug_symbols = xy; then
+   XENO_USER_CFLAGS="-g -O2 $XENO_USER_CFLAGS"
 else
    XENO_USER_CFLAGS="-O2 $XENO_USER_CFLAGS"
 fi
diff --git a/configure.in b/configure.in
index b2b53ef..bfdd015 100644
--- a/configure.in
+++ b/configure.in
@@ -155,16 +155,32 @@ dnl
 dnl Parse options
 dnl
 
-dnl Debug build (default: off)
+dnl Debug build (default: off, no symbols)
 
 debug_mode=
+debug_symbols=
 AC_MSG_CHECKING(whether to enable debug mode)
 AC_ARG_ENABLE(debug,
        AS_HELP_STRING([--enable-debug], [Enable debug mode in programs]),
        [case "$enableval" in
-       y | yes | partial) debug_mode=partial ;;
-       full)    debug_mode=full ;;
-       *) unset debug_mode ;;
+       symbols)
+               debug_symbols=y
+               ;;
+       y | yes | partial)
+               debug_mode=partial
+               debug_symbols=y
+               ;;
+       full)
+               debug_mode=full
+               debug_symbols=y
+               ;;
+       n | no)
+               debug_mode=
+               debug_symbols=
+               ;;
+       *)
+                AC_MSG_ERROR([invalid debug level $enableval])
+                ;;
        esac])
 AC_MSG_RESULT(${debug_mode:-no})
 AM_CONDITIONAL(XENO_DEBUG,[test \! x$debug_mode = x])
@@ -609,7 +625,9 @@ XENO_USER_APP_LDFLAGS=$XENO_USER_LDADD
 if test x$debug_mode = xpartial; then
    XENO_USER_CFLAGS="-g -O2 -D__XENO_DEBUG__ $XENO_USER_CFLAGS"
 elif test x$debug_mode = xfull; then
-   XENO_USER_CFLAGS="-g -D__XENO_DEBUG__ -D__XENO_DEBUG_FULL__ 
$XENO_USER_CFLAGS"
+   XENO_USER_CFLAGS="-g -O0 -D__XENO_DEBUG__ -D__XENO_DEBUG_FULL__ 
$XENO_USER_CFLAGS"
+elif test x$debug_symbols = xy; then
+   XENO_USER_CFLAGS="-g -O2 $XENO_USER_CFLAGS"
 else
    XENO_USER_CFLAGS="-O2 $XENO_USER_CFLAGS"
 fi


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to