From 57bd892b37cdaae11b99b916dbb240870799e18d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 30 May 2006 14:26:30 +0000 Subject: [PATCH] Add "debuglite" mode. --- Makefile.am | 3 +++ debug.h | 36 +++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8ea9ac9d..ccaa95fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,3 +29,6 @@ ColumnsPanel.h debug: $(MAKE) all CFLAGS="-g -DDEBUG" + +debuglite: + $(MAKE) all CFLAGS="-g -DDEBUGLITE" diff --git a/debug.h b/debug.h index 8ef971d6..59fe517a 100644 --- a/debug.h +++ b/debug.h @@ -1,22 +1,28 @@ -#ifdef DEBUG +#if defined(DEBUG) -#include "DebugMemory.h" + /* Full debug */ + #include "DebugMemory.h" + #define calloc(a, b) DebugMemory_calloc(a, b, __FILE__, __LINE__); + #define malloc(x) DebugMemory_malloc(x, __FILE__, __LINE__, #x); + #define realloc(x,s) DebugMemory_realloc(x, s, __FILE__, __LINE__, #x); + #define strdup(x) DebugMemory_strdup(x, __FILE__, __LINE__); + #define free(x) DebugMemory_free(x, __FILE__, __LINE__); + #define debug_done() DebugMemory_report(); -#define calloc(a, b) DebugMemory_calloc(a, b, __FILE__, __LINE__); -#define malloc(x) DebugMemory_malloc(x, __FILE__, __LINE__); -#define realloc(x,s) DebugMemory_realloc(x, s, __FILE__, __LINE__); -#define strdup(x) DebugMemory_strdup(x, __FILE__, __LINE__); -#define free(x) DebugMemory_free(x, __FILE__, __LINE__); +#elif defined(DEBUGLITE) -#define debug_done() DebugMemory_report(); + /* Assertions and core only */ + #ifdef NDEBUG + #undef NDEBUG + #endif + #define debug_done() sleep(0) + +#else + + /* No debugging */ + #define NDEBUG + #define debug_done() sleep(0) #endif -#ifndef DEBUG - -#define NDEBUG - -#define debug_done() sleep(0) - -#endif