You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728
  1. #ifndef DEBUG_H
  2. #define DEBUG_H
  3. //#include <lib.h>
  4. extern int last_putchar;
  5. /* Defining DEBUG_THIS before including this file enables debug() macro
  6. * for the file. DEBUG_ALL is for global control. */
  7. #if DEBUG_THIS || DEBUG_ALL
  8. #define DEBUG 1
  9. #else
  10. #undef DEBUG
  11. #endif
  12. #if DEBUG
  13. # define debug(...) \
  14. ((last_putchar=='\n' ? printf("%s: ", __FUNCTION__) : 0), \
  15. printf(__VA_ARGS__))
  16. # define debug_hexdump hexdump
  17. #else
  18. # define debug(...) /* nothing */
  19. # define debug_hexdump(...) /* nothing */
  20. #endif
  21. #define debugx debug
  22. #endif /* DEBUG_H */