debug.h 673 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
   /* Full debug */
   #include "DebugMemory.h"
Hisham Muhammad's avatar
Hisham Muhammad committed
6
7
8
9
10
   #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__)
11
   #define debug_done() DebugMemory_report(); _nc_freeall()
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
   /* Assertions and core only */
   #ifdef NDEBUG
   #undef NDEBUG
   #endif
Hisham Muhammad's avatar
Hisham Muhammad committed
19
   #define debug_done() 
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
   /* No debugging */
   #define NDEBUG
Hisham Muhammad's avatar
Hisham Muhammad committed
25
   #define debug_done() 
Hisham Muhammad's avatar
Hisham Muhammad committed
26
27

#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
28