# debug.h File Reference

`#include <stdio.h>`
`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/logger.h>`
`#include <gwenhywfar/error.h>`
`#include <gwenhywfar/types.h>`

Go to the source code of this file.

## Defines

#define | DBG_DEBUG(dbg_logger, format, args...)
#define | DBG_DEBUG_ERR(dbg_logger, dbg_err)
#define | DBG_ENTER
#define | DBG_ERROR(dbg_logger, format, args...)
#define | DBG_ERROR_ERR(dbg_logger, dbg_err)
#define | DBG_INFO(dbg_logger, format, args...)
#define | DBG_INFO_ERR(dbg_logger, dbg_err)
#define | DBG_LEAVE
#define | DBG_MEM_DEC(o)
#define | DBG_MEM_INC(o, attach)
#define | DBG_NOTICE(dbg_logger, format, args...)
#define | DBG_NOTICE_ERR(dbg_logger, dbg_err)
#define | DBG_VERBOUS(dbg_logger, format, args...)
#define | DBG_VERBOUS_ERR(dbg_logger, dbg_err)
#define | DBG_WARN(dbg_logger, format, args...)
#define | DBG_WARN_ERR(dbg_logger, dbg_err)
#define | GWEN_MEMORY_DEBUG_MODE_ALL 0
#define | GWEN_MEMORY_DEBUG_MODE_DETAILED 2
#define | GWEN_MEMORY_DEBUG_MODE_OPEN 1
#define | GWEN_MEMORY_DEBUG_MODE_SHORT 3

## Typedefs

typedef GWEN_MEMORY_DEBUG_OBJECT | GWEN_MEMORY_DEBUG_OBJECT

## Functions

GWENHYWFAR_API GWEN_TYPE_UINT32 | GWEN_Debug_Snprintf (char *buffer, GWEN_TYPE_UINT32 size, const char *fmt,...)
GWENHYWFAR_API void | GWEN_MemoryDebug_CleanUp ()
GWENHYWFAR_API void | GWEN_MemoryDebug_Decrement (const char *name, const char *wFile, int wLine)
GWENHYWFAR_API void | GWEN_MemoryDebug_Dump (GWEN_TYPE_UINT32 mode)
GWENHYWFAR_API void | GWEN_MemoryDebug_DumpObject (const char *name, GWEN_TYPE_UINT32 mode)
GWENHYWFAR_API long int | GWEN_MemoryDebug_GetObjectCount (const char *name)
GWENHYWFAR_API void | GWEN_MemoryDebug_Increment (const char *name, const char *wFile, int wLine, int attach)

## Define Documentation

#define DBG_DEBUG | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelDebug) {\
     char dbg_buffer[256]; \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelDebug, dbg_buffer);};

#define DBG_DEBUG_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelDebug) {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelDebug, dbg_buffer);};

#define DBG_ENTER

#define DBG_ERROR | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    if (1){\
      char dbg_buffer[256]; \
      snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
      __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelError, dbg_buffer);};

#define DBG_ERROR_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelError, dbg_buffer);};

#define DBG_INFO | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelInfo) {\
      char dbg_buffer[256]; \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelInfo, dbg_buffer);};

#define DBG_INFO_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelInfo) {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelInfo, dbg_buffer);};

#define DBG_LEAVE

#define DBG_MEM_DEC | ( | o |  | ) |

#define DBG_MEM_INC | ( | o,
|  | attach |  | ) |

#define DBG_NOTICE | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelNotice) {\
     char dbg_buffer[256]; \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelNotice, dbg_buffer);};

#define DBG_NOTICE_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelNotice) {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelNotice, dbg_buffer);};

#define DBG_VERBOUS | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelVerbous) {\
     char dbg_buffer[256]; \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelVerbous, dbg_buffer);};

#define DBG_VERBOUS_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    if (GWEN_Logger_GetLevel(dbg_logger)>=GWEN_LoggerLevelVerbous) {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelVerbous, dbg_buffer);};

#define DBG_WARN | ( | dbg_logger,
|  | format,
|  | args... |  | ) |

Value:

    {\
      char dbg_buffer[256]; \
      snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
      __FILE__":%5d: " format  , __LINE__ , ## args); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelWarning, dbg_buffer);};

#define DBG_WARN_ERR | ( | dbg_logger,
|  | dbg_err |  | ) |

Value:

    {\
     char dbg_buffer[256]; \
     char dbg_errbuff[256]; \
     GWEN_Error_ToString(dbg_err,dbg_errbuff, sizeof(dbg_errbuff)); \
     snprintf(dbg_buffer, sizeof(dbg_buffer)-1,\
     __FILE__":%5d: %s" , __LINE__ , dbg_errbuff); \
      dbg_buffer[sizeof(dbg_buffer)-1]=0; \
     GWEN_Logger_Log(dbg_logger, GWEN_LoggerLevelWarning, dbg_buffer);};

#define GWEN_MEMORY_DEBUG_MODE_ALL 0

#define GWEN_MEMORY_DEBUG_MODE_DETAILED 2

#define GWEN_MEMORY_DEBUG_MODE_OPEN 1

#define GWEN_MEMORY_DEBUG_MODE_SHORT 3

## Typedef Documentation

typedef struct GWEN_MEMORY_DEBUG_OBJECT GWEN_MEMORY_DEBUG_OBJECT

## Function Documentation

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_Debug_Snprintf | ( | char * | buffer,
|  | GWEN_TYPE_UINT32 | size,
|  | const char * | fmt,
|  |  | ...
| ) |

GWENHYWFAR_API void GWEN_MemoryDebug_CleanUp | ( |  | ) |

GWENHYWFAR_API void GWEN_MemoryDebug_Decrement | ( | const char * | name,
|  | const char * | wFile,
|  | int | wLine
| ) |

GWENHYWFAR_API void GWEN_MemoryDebug_Dump | ( | GWEN_TYPE_UINT32 | mode | ) |

GWENHYWFAR_API void GWEN_MemoryDebug_DumpObject | ( | const char * | name,
|  | GWEN_TYPE_UINT32 | mode
| ) |

GWENHYWFAR_API long int GWEN_MemoryDebug_GetObjectCount | ( | const char * | name | ) |

GWENHYWFAR_API void GWEN_MemoryDebug_Increment | ( | const char * | name,
|  | const char * | wFile,
|  | int | wLine,
|  | int | attach
| ) |