Added back the *DEBUG macros so you can choose which debug

messages you get by defining one or more of those macros.
Added configure switch to enable them.
This commit is contained in:
yabause 2008-11-28 23:26:26 +00:00
parent de243e9396
commit 3316d1e0b4
2 changed files with 39 additions and 13 deletions

View File

@ -205,6 +205,18 @@ dnl - Enable debug mode
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
AC_HELP_STRING(--enable-debug, enable debug information), AC_HELP_STRING(--enable-debug, enable debug information),
AC_DEFINE(DEBUG)) AC_DEFINE(DEBUG))
AC_ARG_ENABLE(gpu-debug,
AC_HELP_STRING(--enable-gpu-debug, enable gpu debug information),
AC_DEFINE(GPUDEBUG))
AC_ARG_ENABLE(div-debug,
AC_HELP_STRING(--enable-div-debug, enable div debug information),
AC_DEFINE(DIVDEBUG))
AC_ARG_ENABLE(sqrt-debug,
AC_HELP_STRING(--enable-sqrt-debug, enable sqrt debug information),
AC_DEFINE(SQRTDEBUG))
AC_ARG_ENABLE(dma-debug,
AC_HELP_STRING(--enable-dma-debug, enable dma debug information),
AC_DEFINE(DMADEBUG))
dnl - Enable memory profiling dnl - Enable memory profiling
AC_ARG_ENABLE(memory-profiling, AC_ARG_ENABLE(memory-profiling,

View File

@ -51,26 +51,40 @@ public:
static void log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message)); static void log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message));
}; };
#ifdef DEBUG #if defined(DEBUG) || defined(GPUDEBUG) || defined(DIVDEBUG) || defined(SQRTDEBUG) || defined(DMADEBUG)
#define LOGC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__) #define LOGC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
#define LOG(...) LOGC(0, __VA_ARGS__)
#define GPULOG(...) LOGC(1, __VA_ARGS__)
#define DIVLOG(...) LOGC(2, __VA_ARGS__)
#define SQRTLOG(...) LOGC(3, __VA_ARGS__)
#define DMALOG(...) LOGC(3, __VA_ARGS__)
#else #else
#define LOGC(...) #define LOGC(...)
#endif
#ifdef DEBUG
#define LOG(...) LOGC(0, __VA_ARGS__)
#else
#define LOG(...) #define LOG(...)
#endif
#ifdef GPUDEBUG
#define GPULOG(...) LOGC(1, __VA_ARGS__)
#else
#define GPULOG(...) #define GPULOG(...)
#define DIVLOG(...) #endif
#define SQRTLOG(...)
#define DMALOG(...)
#ifdef DIVDEBUG
#define DIVLOG(...) LOGC(2, __VA_ARGS__)
#else
#define DIVLOG(...)
#endif
#ifdef SQRTDEBUG
#define SQRTLOG(...) LOGC(3, __VA_ARGS__)
#else
#define SQRTLOG(...)
#endif
#ifdef DMADEBUG
#define DMALOG(...) LOGC(4, __VA_ARGS__)
#else
#define DMALOG(...)
#endif #endif
#define INFOC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__) #define INFOC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)