debug.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _DEBUG_H
  2. #define _DEBUG_H
  3. #ifdef HAVE_CONFIG_H
  4. # include "config.h"
  5. #endif
  6. /*
  7. * Undefine this to completely disable context debugging.
  8. * WARNING: DO NOT send in bug reports if you undefine this!
  9. */
  10. //#define DEBUG_CONTEXT
  11. /*
  12. * Handy aliases for memory tracking and core dumps
  13. */
  14. #ifdef DEBUG_CONTEXT
  15. # define Context eggContext(__FILE__, __LINE__)
  16. # define ContextNote(note) eggContextNote(__FILE__, __LINE__, note)
  17. #else
  18. # define Context {}
  19. # define ContextNote(note) {}
  20. #endif
  21. #ifdef DEBUG_ASSERT
  22. # define Assert(expr) do { \
  23. if (!(expr)) \
  24. eggAssert(__FILE__, __LINE__); \
  25. } while (0)
  26. #else
  27. # define Assert(expr) do { } while (0)
  28. #endif
  29. #define debug0(x) putlog(LOG_DEBUG,"*",x)
  30. #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
  31. #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
  32. #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
  33. #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
  34. extern bool sdebug;
  35. void stackdump(int);
  36. void setlimits();
  37. void sdprintf (char *, ...) __attribute__((format(printf, 1, 2)));
  38. void init_signals();
  39. void init_debug();
  40. void eggContext(const char *, int);
  41. void eggContextNote(const char *, int, const char *);
  42. void eggAssert(const char *, int);
  43. #endif /* !_DEBUG_H */