]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Enable GNU libc "memory tracing" when compiled with debug code.
authorAlexander Barton <alex@barton.de>
Wed, 13 Aug 2008 14:00:57 +0000 (16:00 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 13 Aug 2008 14:00:57 +0000 (16:00 +0200)
This patch lets ngIRCd activate "memory tracing" of the GNU libc when
compiled with debug code (configure: --enable-debug) and the functionality
is available on the system.
(http://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html)

configure.in
src/ngircd/ngircd.c

index 7cbc80ac13653164754515de97dfc19be398122f..36f0bc28afb18e27f728af621bd2bb739774156f 100644 (file)
@@ -457,6 +457,7 @@ AC_ARG_ENABLE(debug,
 if test "$x_debug_on" = "yes"; then
        AC_DEFINE(DEBUG, 1)
        test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
+       AC_CHECK_FUNCS(mtrace)
 fi
 
 # enable "strict RFC rules"?
index 9239edfe11ca601a635dcf8977e188f7c1ccbac1..952a10a435beb4cd0c581be5a2d6ca1103568347 100644 (file)
@@ -84,6 +84,12 @@ main( int argc, const char *argv[] )
        int i;
        size_t n;
 
+#if defined(DEBUG) && defined(HAVE_MTRACE)
+       /* enable GNU libc memory tracing when running in debug mode
+        * and functionality available */
+       mtrace();
+#endif
+
        umask( 0077 );
 
        NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = false;