Xenomai API  2.5.6.1
include/nucleus/assert.h
00001 /*
00002  * Copyright (C) 2006 Philippe Gerum <[email protected]>.
00003  *
00004  * Xenomai is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published
00006  * by the Free Software Foundation; either version 2 of the License,
00007  * or (at your option) any later version.
00008  *
00009  * Xenomai is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with Xenomai; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA.
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)                   \
00026         (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
00027 
00028 #define XENO_ASSERT(subsystem,cond,action)  do {                        \
00029                 if (unlikely(XENO_DEBUG(subsystem) && !(cond))) {       \
00030                         xnarch_trace_panic_freeze();                    \
00031                         xnlogerr("assertion failed at %s:%d (%s)\n",    \
00032                                  __FILE__, __LINE__, (#cond));          \
00033                         xnarch_trace_panic_dump();                      \
00034                         action;                                         \
00035                 }                                                       \
00036         } while(0)
00037 
00038 #define XENO_BUGON(subsystem,cond)                                      \
00039         do {                                                            \
00040                 if (unlikely(XENO_DEBUG(subsystem) && (cond)))          \
00041                         xnpod_fatal("bug at %s:%d (%s)",                \
00042                                     __FILE__, __LINE__, (#cond));       \
00043         } while(0)
00044 
00045 #ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
00046 #define CONFIG_XENO_OPT_DEBUG_QUEUES 0
00047 #endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
00048 #ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
00049 #define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
00050 #endif /* CONFIG_XENO_OPT_DEBUG_NUCLEUS */
00051 
00052 #endif /* !_XENO_NUCLEUS_ASSERT_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines