debug.h 680 Bytes
Newer Older
Hisham Muhammad's avatar
Hisham Muhammad committed
1

Hisham Muhammad's avatar
Hisham Muhammad committed
2
#if defined(DEBUG)
Hisham Muhammad's avatar
Hisham Muhammad committed
3

Hisham Muhammad's avatar
Hisham Muhammad committed
4
5
6
7
8
9
10
11
   /* 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();
Hisham Muhammad's avatar
Hisham Muhammad committed
12

Hisham Muhammad's avatar
Hisham Muhammad committed
13
#elif defined(DEBUGLITE)
Hisham Muhammad's avatar
Hisham Muhammad committed
14

Hisham Muhammad's avatar
Hisham Muhammad committed
15
16
17
18
19
   /* Assertions and core only */
   #ifdef NDEBUG
   #undef NDEBUG
   #endif
   #define debug_done() sleep(0)
Hisham Muhammad's avatar
Hisham Muhammad committed
20

Hisham Muhammad's avatar
Hisham Muhammad committed
21
#else
Hisham Muhammad's avatar
Hisham Muhammad committed
22

Hisham Muhammad's avatar
Hisham Muhammad committed
23
24
25
   /* No debugging */
   #define NDEBUG
   #define debug_done() sleep(0)
Hisham Muhammad's avatar
Hisham Muhammad committed
26
27

#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
28