00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef _XENO_NUCLEUS_ASSERT_H
00021 #define _XENO_NUCLEUS_ASSERT_H
00022 
00023 #include <nucleus/types.h>
00024 
00025 #define XENO_DEBUG(subsystem)   (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
00026 
00027 #define XENO_ASSERT(subsystem,cond,action)  do { \
00028     if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && !(cond))) { \
00029         xnarch_trace_panic_freeze(); \
00030         xnlogerr("assertion failed at %s:%d (%s)\n", __FILE__, __LINE__, (#cond)); \
00031         xnarch_trace_panic_dump(); \
00032         action; \
00033     } \
00034 } while(0)
00035 
00036 #define XENO_BUGON(subsystem,cond)  do { \
00037     if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && (cond))) \
00038         xnpod_fatal("bug at %s:%d (%s)", __FILE__, __LINE__, (#cond)); \
00039 } while(0)
00040 
00041 #endif