gonzui


Format: Advanced Search

tkernel_2/include/sys/debug.hbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by T-Engine Forum at 2013/03/07.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: 
   16: /*
   17:  *      @(#)debug.h (sys)
   18:  *
   19:  *      Debug support
   20:  */
   21: 
   22: #ifndef __SYS_DEBUG_H__
   23: #define __SYS_DEBUG_H__
   24: 
   25: #include <basic.h>
   26: 
   27: #ifdef DEBUG
   28: #include <tm/tmonitor.h>
   29: #endif
   30: 
   31: #ifdef __cplusplus
   32: extern "C" {
   33: #endif
   34: 
   35: /*
   36:  * Example
   37:  *      DEBUG_PRINT(("error = %d\n", ercd));
   38:  *
   39:  *      DO_DEBUG( if ( ercd < ER_OK ) DEBUG_PRINT(("error = %d\n", ercd)); )
   40:  */
   41: #ifdef DEBUG
   42: 
   43: #ifndef DEBUG_MODULE
   44: #define DEBUG_MODULE    "" /* Normally define like "(module name)" */
   45: #endif
   46: 
   47: #define DEBUG_PRINT(arg)                                                \
   48:         (                                                              \
   49:                 tm_printf("%s#%d%s:", __FILE__, __LINE__, DEBUG_MODULE),      \
   50:                 tm_printf arg                                         \
   51:         )
   52: #define TM_DEBUG_PRINT(arg)                                             \
   53:         (                                                              \
   54:                 tm_printf("%s#%d%s:", __FILE__, __LINE__, DEBUG_MODULE), \
   55:                 tm_printf arg                                         \
   56:         )
   57: 
   58: #define DO_DEBUG(exp)   { exp }
   59: 
   60: #else /* DEBUG */
   61: 
   62: #define DEBUG_PRINT(arg)        /* arg */
   63: #define TM_DEBUG_PRINT(arg)     /* arg */
   64: #define DO_DEBUG(exp)           /* exp */
   65: 
   66: #endif /* DEBUG */
   67: 
   68: #ifdef __cplusplus
   69: }
   70: #endif
   71: #endif /* __SYS_DEBUG_H__ */