1171095Ssam/*- 2171095Ssam * Copyright (c) 2002-2007 Neterion, Inc. 3171095Ssam * All rights reserved. 4171095Ssam * 5171095Ssam * Redistribution and use in source and binary forms, with or without 6171095Ssam * modification, are permitted provided that the following conditions 7171095Ssam * are met: 8171095Ssam * 1. Redistributions of source code must retain the above copyright 9171095Ssam * notice, this list of conditions and the following disclaimer. 10171095Ssam * 2. Redistributions in binary form must reproduce the above copyright 11171095Ssam * notice, this list of conditions and the following disclaimer in the 12171095Ssam * documentation and/or other materials provided with the distribution. 13171095Ssam * 14171095Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15171095Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16171095Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17171095Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18171095Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19171095Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20171095Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21171095Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22171095Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23171095Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24171095Ssam * SUCH DAMAGE. 25171095Ssam * 26171095Ssam * $FreeBSD: releng/11.0/sys/dev/nxge/include/xge-debug.h 173139 2007-10-29 14:19:32Z rwatson $ 27171095Ssam */ 28171095Ssam 29171095Ssam#ifndef XGE_DEBUG_H 30171095Ssam#define XGE_DEBUG_H 31171095Ssam 32171095Ssam#include <dev/nxge/include/xge-os-pal.h> 33171095Ssam 34171095Ssam__EXTERN_BEGIN_DECLS 35171095Ssam 36171095Ssam/* 37171095Ssam * __FUNCTION__ is, together with __PRETTY_FUNCTION__ or something similar, 38171095Ssam * a gcc extension. we'll have to #ifdef around that, and provide some 39171095Ssam * meaningful replacement for those, so to make some gcc versions happier 40171095Ssam */ 41171095Ssam#ifndef __func__ 42171095Ssam#ifdef __FUNCTION__ 43171095Ssam#define __func__ __FUNCTION__ 44171095Ssam#endif 45171095Ssam#endif 46171095Ssam 47171095Ssam 48171095Ssam#ifdef XGE_DEBUG_FP 49173139Srwatson#define XGE_DEBUG_FP_DEVICE 0x1 50171095Ssam#define XGE_DEBUG_FP_CHANNEL 0x2 51173139Srwatson#define XGE_DEBUG_FP_FIFO 0x4 52173139Srwatson#define XGE_DEBUG_FP_RING 0x8 53173139Srwatson#define XGE_DEBUG_FP_ALL 0xff 54171095Ssam#endif 55171095Ssam 56171095Ssam/** 57171095Ssam * enum xge_debug_level_e 58171095Ssam * @XGE_NONE: debug disabled 59171095Ssam * @XGE_ERR: all errors going to be logged out 60171095Ssam * @XGE_TRACE: all errors plus all kind of verbose tracing print outs 61171095Ssam * going to be logged out. Very noisy. 62171095Ssam * 63171095Ssam * This enumeration going to be used to switch between different 64171095Ssam * debug levels during runtime if DEBUG macro defined during 65171095Ssam * compilation. If DEBUG macro not defined than code will be 66171095Ssam * compiled out. 67171095Ssam */ 68171095Ssamtypedef enum xge_debug_level_e { 69171095Ssam XGE_NONE = 0, 70171095Ssam XGE_TRACE = 1, 71171095Ssam XGE_ERR = 2, 72171095Ssam} xge_debug_level_e; 73171095Ssam 74171095Ssam#define XGE_DEBUG_MODULE_MASK_DEF 0x30000030 75171095Ssam#define XGE_DEBUG_LEVEL_DEF XGE_ERR 76171095Ssam 77171095Ssam#if defined(XGE_DEBUG_TRACE_MASK) || defined(XGE_DEBUG_ERR_MASK) 78171095Ssam 79171095Ssamextern unsigned long *g_module_mask; 80171095Ssamextern int *g_level; 81171095Ssam 82171095Ssam#ifndef XGE_DEBUG_TRACE_MASK 83171095Ssam#define XGE_DEBUG_TRACE_MASK 0 84171095Ssam#endif 85171095Ssam 86171095Ssam#ifndef XGE_DEBUG_ERR_MASK 87171095Ssam#define XGE_DEBUG_ERR_MASK 0 88171095Ssam#endif 89171095Ssam 90171095Ssam/* 91171095Ssam * @XGE_COMPONENT_HAL_CONFIG: do debug for xge core config module 92171095Ssam * @XGE_COMPONENT_HAL_FIFO: do debug for xge core fifo module 93171095Ssam * @XGE_COMPONENT_HAL_RING: do debug for xge core ring module 94171095Ssam * @XGE_COMPONENT_HAL_CHANNEL: do debug for xge core channel module 95171095Ssam * @XGE_COMPONENT_HAL_DEVICE: do debug for xge core device module 96171095Ssam * @XGE_COMPONENT_HAL_DMQ: do debug for xge core DMQ module 97171095Ssam * @XGE_COMPONENT_HAL_UMQ: do debug for xge core UMQ module 98171095Ssam * @XGE_COMPONENT_HAL_SQ: do debug for xge core SQ module 99171095Ssam * @XGE_COMPONENT_HAL_SRQ: do debug for xge core SRQ module 100171095Ssam * @XGE_COMPONENT_HAL_CQRQ: do debug for xge core CRQ module 101171095Ssam * @XGE_COMPONENT_HAL_POOL: do debug for xge core memory pool module 102171095Ssam * @XGE_COMPONENT_HAL_BITMAP: do debug for xge core BITMAP module 103171095Ssam * @XGE_COMPONENT_CORE: do debug for xge KMA core module 104171095Ssam * @XGE_COMPONENT_OSDEP: do debug for xge KMA os dependent parts 105171095Ssam * @XGE_COMPONENT_LL: do debug for xge link layer module 106171095Ssam * @XGE_COMPONENT_ALL: activate debug for all modules with no exceptions 107171095Ssam * 108171095Ssam * This enumeration going to be used to distinguish modules 109171095Ssam * or libraries during compilation and runtime. Makefile must declare 110171095Ssam * XGE_DEBUG_MODULE_MASK macro and set it to proper value. 111171095Ssam */ 112171095Ssam#define XGE_COMPONENT_HAL_CONFIG 0x00000001 113171095Ssam#define XGE_COMPONENT_HAL_FIFO 0x00000002 114171095Ssam#define XGE_COMPONENT_HAL_RING 0x00000004 115171095Ssam#define XGE_COMPONENT_HAL_CHANNEL 0x00000008 116171095Ssam#define XGE_COMPONENT_HAL_DEVICE 0x00000010 117171095Ssam#define XGE_COMPONENT_HAL_MM 0x00000020 118171095Ssam#define XGE_COMPONENT_HAL_QUEUE 0x00000040 119171095Ssam#define XGE_COMPONENT_HAL_INTERRUPT 0x00000080 120171095Ssam#define XGE_COMPONENT_HAL_STATS 0x00000100 121171095Ssam 122171095Ssam /* space for CORE_XXX */ 123171095Ssam#define XGE_COMPONENT_OSDEP 0x10000000 124171095Ssam#define XGE_COMPONENT_LL 0x20000000 125171095Ssam#define XGE_COMPONENT_ALL 0xffffffff 126171095Ssam 127171095Ssam#ifndef XGE_DEBUG_MODULE_MASK 128171095Ssam#error "XGE_DEBUG_MODULE_MASK macro must be defined for DEBUG mode..." 129171095Ssam#endif 130171095Ssam 131171095Ssam#ifndef __GNUC__ 132171095Ssam#ifdef XGE_TRACE_INTO_CIRCULAR_ARR 133173139Srwatson #define xge_trace_aux(fmt) xge_os_vatrace(g_xge_os_tracebuf, fmt) 134171095Ssam#else 135173139Srwatson #define xge_trace_aux(fmt) xge_os_vaprintf(fmt) 136171095Ssam#endif 137171095Ssam 138171095Ssam/** 139171095Ssam * xge_debug 140171095Ssam * @level: level of debug verbosity. 141171095Ssam * @fmt: printf like format string 142171095Ssam * 143171095Ssam * Provides logging facilities. Can be customized on per-module 144171095Ssam * basis or/and with debug levels. Input parameters, except 145171095Ssam * module and level, are the same as posix printf. This function 146171095Ssam * may be compiled out if DEBUG macro was never defined. 147171095Ssam * See also: xge_debug_level_e{}. 148171095Ssam */ 149171095Ssam#define xge_debug(module, level, fmt) { \ 150171095Ssamif (((level >= XGE_TRACE && ((module & XGE_DEBUG_TRACE_MASK) == module)) || \ 151173139Srwatson (level >= XGE_ERR && ((module & XGE_DEBUG_ERR_MASK) == module))) && \ 152173139Srwatson level >= *g_level && module & *(unsigned int *)g_module_mask) { \ 153173139Srwatson xge_trace_aux(fmt); \ 154171095Ssam } \ 155171095Ssam} 156171095Ssam#else /* __GNUC__ */ 157171095Ssam 158171095Ssam#ifdef XGE_TRACE_INTO_CIRCULAR_ARR 159173139Srwatson #define xge_trace_aux(fmt...) xge_os_trace(g_xge_os_tracebuf, fmt) 160171095Ssam#else 161173139Srwatson #define xge_trace_aux(fmt...) xge_os_printf(fmt) 162171095Ssam#endif 163171095Ssam 164171095Ssam#define xge_debug(module, level, fmt...) { \ 165171095Ssamif (((level >= XGE_TRACE && ((module & XGE_DEBUG_TRACE_MASK) == module)) || \ 166173139Srwatson (level >= XGE_ERR && ((module & XGE_DEBUG_ERR_MASK) == module))) && \ 167173139Srwatson level >= *g_level && module & *(unsigned int *)g_module_mask) { \ 168173139Srwatson xge_trace_aux(fmt); \ 169171095Ssam } \ 170171095Ssam} 171171095Ssam#endif /* __GNUC__ */ 172171095Ssam 173171095Ssam#if (XGE_COMPONENT_HAL_STATS & XGE_DEBUG_MODULE_MASK) 174171095Ssam#ifndef __GNUC__ 175171095Ssamstatic inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) { 176171095Ssam u32 module = XGE_COMPONENT_HAL_STATS; 177171095Ssam xge_debug(module, level, fmt); 178171095Ssam} 179171095Ssam#else /* __GNUC__ */ 180171095Ssam#define xge_debug_stats(level, fmt...) \ 181171095Ssam xge_debug(XGE_COMPONENT_HAL_STATS, level, fmt) 182171095Ssam#endif /* __GNUC__ */ 183171095Ssam#else 184171095Ssam#ifndef __GNUC__ 185171095Ssamstatic inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) {} 186171095Ssam#else /* __GNUC__ */ 187171095Ssam#define xge_debug_stats(level, fmt...) 188171095Ssam#endif /* __GNUC__ */ 189171095Ssam#endif 190171095Ssam 191171095Ssam/* Interrupt Related */ 192171095Ssam#if (XGE_COMPONENT_HAL_INTERRUPT & XGE_DEBUG_MODULE_MASK) 193171095Ssam#ifndef __GNUC__ 194171095Ssamstatic inline void xge_debug_interrupt(xge_debug_level_e level, char *fmt, ...) { 195171095Ssam u32 module = XGE_COMPONENT_HAL_INTERRUPT; 196171095Ssam xge_debug(module, level, fmt); 197171095Ssam} 198171095Ssam#else /* __GNUC__ */ 199171095Ssam#define xge_debug_interrupt(level, fmt...) \ 200171095Ssam xge_debug(XGE_COMPONENT_HAL_INTERRUPT, level, fmt) 201171095Ssam#endif /* __GNUC__ */ 202171095Ssam#else 203171095Ssam#ifndef __GNUC__ 204171095Ssamstatic inline void xge_debug_interrupt(xge_debug_level_e level, char *fmt, ...) {} 205171095Ssam#else /* __GNUC__ */ 206171095Ssam#define xge_debug_interrupt(level, fmt...) 207171095Ssam#endif /* __GNUC__ */ 208171095Ssam#endif 209171095Ssam 210171095Ssam#if (XGE_COMPONENT_HAL_QUEUE & XGE_DEBUG_MODULE_MASK) 211171095Ssam#ifndef __GNUC__ 212171095Ssamstatic inline void xge_debug_queue(xge_debug_level_e level, char *fmt, ...) { 213171095Ssam u32 module = XGE_COMPONENT_HAL_QUEUE; 214171095Ssam xge_debug(module, level, fmt); 215171095Ssam} 216171095Ssam#else /* __GNUC__ */ 217171095Ssam#define xge_debug_queue(level, fmt...) \ 218171095Ssam xge_debug(XGE_COMPONENT_HAL_QUEUE, level, fmt) 219171095Ssam#endif /* __GNUC__ */ 220171095Ssam#else 221171095Ssam#ifndef __GNUC__ 222171095Ssamstatic inline void xge_debug_queue(xge_debug_level_e level, char *fmt, 223171095Ssam...) {} 224171095Ssam#else /* __GNUC__ */ 225171095Ssam#define xge_debug_queue(level, fmt...) 226171095Ssam#endif /* __GNUC__ */ 227171095Ssam#endif 228171095Ssam 229171095Ssam#if (XGE_COMPONENT_HAL_MM & XGE_DEBUG_MODULE_MASK) 230171095Ssam#ifndef __GNUC__ 231171095Ssamstatic inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) 232171095Ssam{ 233171095Ssam u32 module = XGE_COMPONENT_HAL_MM; 234171095Ssam xge_debug(module, level, fmt); 235171095Ssam} 236171095Ssam#else /* __GNUC__ */ 237171095Ssam#define xge_debug_mm(level, fmt...) \ 238171095Ssam xge_debug(XGE_COMPONENT_HAL_MM, level, fmt) 239171095Ssam#endif /* __GNUC__ */ 240171095Ssam#else 241171095Ssam#ifndef __GNUC__ 242171095Ssamstatic inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) 243171095Ssam{} 244171095Ssam#else /* __GNUC__ */ 245171095Ssam#define xge_debug_mm(level, fmt...) 246171095Ssam#endif /* __GNUC__ */ 247171095Ssam#endif 248171095Ssam 249171095Ssam#if (XGE_COMPONENT_HAL_CONFIG & XGE_DEBUG_MODULE_MASK) 250171095Ssam#ifndef __GNUC__ 251171095Ssamstatic inline void xge_debug_config(xge_debug_level_e level, char *fmt, ...) { 252171095Ssam u32 module = XGE_COMPONENT_HAL_CONFIG; 253171095Ssam xge_debug(module, level, fmt); 254171095Ssam} 255171095Ssam#else /* __GNUC__ */ 256171095Ssam#define xge_debug_config(level, fmt...) \ 257171095Ssam xge_debug(XGE_COMPONENT_HAL_CONFIG, level, fmt) 258171095Ssam#endif /* __GNUC__ */ 259171095Ssam#else 260171095Ssam#ifndef __GNUC__ 261171095Ssamstatic inline void xge_debug_config(xge_debug_level_e level, char *fmt, 262171095Ssam...) {} 263171095Ssam#else /* __GNUC__ */ 264171095Ssam#define xge_debug_config(level, fmt...) 265171095Ssam#endif /* __GNUC__ */ 266171095Ssam#endif 267171095Ssam 268171095Ssam#if (XGE_COMPONENT_HAL_FIFO & XGE_DEBUG_MODULE_MASK) 269171095Ssam#ifndef __GNUC__ 270171095Ssamstatic inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) { 271171095Ssam u32 module = XGE_COMPONENT_HAL_FIFO; 272171095Ssam xge_debug(module, level, fmt); 273171095Ssam} 274171095Ssam#else /* __GNUC__ */ 275171095Ssam#define xge_debug_fifo(level, fmt...) \ 276171095Ssam xge_debug(XGE_COMPONENT_HAL_FIFO, level, fmt) 277171095Ssam#endif /* __GNUC__ */ 278171095Ssam#else 279171095Ssam#ifndef __GNUC__ 280171095Ssamstatic inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) {} 281171095Ssam#else /* __GNUC__ */ 282171095Ssam#define xge_debug_fifo(level, fmt...) 283171095Ssam#endif /* __GNUC__ */ 284171095Ssam#endif 285171095Ssam 286171095Ssam#if (XGE_COMPONENT_HAL_RING & XGE_DEBUG_MODULE_MASK) 287171095Ssam#ifndef __GNUC__ 288171095Ssamstatic inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) { 289171095Ssam u32 module = XGE_COMPONENT_HAL_RING; 290171095Ssam xge_debug(module, level, fmt); 291171095Ssam} 292171095Ssam#else /* __GNUC__ */ 293171095Ssam#define xge_debug_ring(level, fmt...) \ 294171095Ssam xge_debug(XGE_COMPONENT_HAL_RING, level, fmt) 295171095Ssam#endif /* __GNUC__ */ 296171095Ssam#else 297171095Ssam#ifndef __GNUC__ 298171095Ssamstatic inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) {} 299171095Ssam#else /* __GNUC__ */ 300171095Ssam#define xge_debug_ring(level, fmt...) 301171095Ssam#endif /* __GNUC__ */ 302171095Ssam#endif 303171095Ssam 304171095Ssam#if (XGE_COMPONENT_HAL_CHANNEL & XGE_DEBUG_MODULE_MASK) 305171095Ssam#ifndef __GNUC__ 306171095Ssamstatic inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) { 307171095Ssam u32 module = XGE_COMPONENT_HAL_CHANNEL; 308171095Ssam xge_debug(module, level, fmt); 309171095Ssam} 310171095Ssam#else /* __GNUC__ */ 311171095Ssam#define xge_debug_channel(level, fmt...) \ 312171095Ssam xge_debug(XGE_COMPONENT_HAL_CHANNEL, level, fmt) 313171095Ssam#endif /* __GNUC__ */ 314171095Ssam#else 315171095Ssam#ifndef __GNUC__ 316171095Ssamstatic inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) {} 317171095Ssam#else /* __GNUC__ */ 318171095Ssam#define xge_debug_channel(level, fmt...) 319171095Ssam#endif /* __GNUC__ */ 320171095Ssam#endif 321171095Ssam 322171095Ssam#if (XGE_COMPONENT_HAL_DEVICE & XGE_DEBUG_MODULE_MASK) 323171095Ssam#ifndef __GNUC__ 324171095Ssamstatic inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) { 325171095Ssam u32 module = XGE_COMPONENT_HAL_DEVICE; 326171095Ssam xge_debug(module, level, fmt); 327171095Ssam} 328171095Ssam#else /* __GNUC__ */ 329171095Ssam#define xge_debug_device(level, fmt...) \ 330171095Ssam xge_debug(XGE_COMPONENT_HAL_DEVICE, level, fmt) 331171095Ssam#endif /* __GNUC__ */ 332171095Ssam#else 333171095Ssam#ifndef __GNUC__ 334171095Ssamstatic inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) {} 335171095Ssam#else /* __GNUC__ */ 336171095Ssam#define xge_debug_device(level, fmt...) 337171095Ssam#endif /* __GNUC__ */ 338171095Ssam#endif 339171095Ssam 340171095Ssam#if (XGE_COMPONENT_OSDEP & XGE_DEBUG_MODULE_MASK) 341171095Ssam#ifndef __GNUC__ 342171095Ssamstatic inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) { 343171095Ssam u32 module = XGE_COMPONENT_OSDEP; 344171095Ssam xge_debug(module, level, fmt); 345171095Ssam} 346171095Ssam#else /* __GNUC__ */ 347171095Ssam#define xge_debug_osdep(level, fmt...) \ 348171095Ssam xge_debug(XGE_COMPONENT_OSDEP, level, fmt) 349171095Ssam#endif /* __GNUC__ */ 350171095Ssam#else 351171095Ssam#ifndef __GNUC__ 352171095Ssamstatic inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) {} 353171095Ssam#else /* __GNUC__ */ 354171095Ssam#define xge_debug_osdep(level, fmt...) 355171095Ssam#endif /* __GNUC__ */ 356171095Ssam#endif 357171095Ssam 358171095Ssam#if (XGE_COMPONENT_LL & XGE_DEBUG_MODULE_MASK) 359171095Ssam#ifndef __GNUC__ 360171095Ssamstatic inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) 361171095Ssam{ 362171095Ssam u32 module = XGE_COMPONENT_LL; 363171095Ssam xge_debug(module, level, fmt); 364171095Ssam} 365171095Ssam#else /* __GNUC__ */ 366171095Ssam#define xge_debug_ll(level, fmt...) \ 367171095Ssam xge_debug(XGE_COMPONENT_LL, level, fmt) 368171095Ssam#endif /* __GNUC__ */ 369171095Ssam#else 370171095Ssam#ifndef __GNUC__ 371171095Ssamstatic inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) {} 372171095Ssam#else /* __GNUC__ */ 373171095Ssam#define xge_debug_ll(level, fmt...) 374171095Ssam#endif /* __GNUC__ */ 375171095Ssam#endif 376171095Ssam 377171095Ssam#else 378171095Ssam 379171095Ssamstatic inline void xge_debug_interrupt(xge_debug_level_e level, char *fmt, ...) {} 380171095Ssamstatic inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) {} 381171095Ssamstatic inline void xge_debug_queue(xge_debug_level_e level, char *fmt, ...) {} 382171095Ssamstatic inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) {} 383171095Ssamstatic inline void xge_debug_config(xge_debug_level_e level, char *fmt, ...) {} 384171095Ssamstatic inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) {} 385171095Ssamstatic inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) {} 386171095Ssamstatic inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) {} 387171095Ssamstatic inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) {} 388171095Ssamstatic inline void xge_debug_hal(xge_debug_level_e level, char *fmt, ...) {} 389171095Ssamstatic inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) {} 390171095Ssamstatic inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) {} 391171095Ssam 392171095Ssam#endif /* end of XGE_DEBUG_*_MASK */ 393171095Ssam 394171095Ssam#ifdef XGE_DEBUG_ASSERT 395171095Ssam 396171095Ssam/** 397171095Ssam * xge_assert 398171095Ssam * @test: C-condition to check 399171095Ssam * @fmt: printf like format string 400171095Ssam * 401171095Ssam * This function implements traditional assert. By default assertions 402171095Ssam * are enabled. It can be disabled by defining XGE_DEBUG_ASSERT macro in 403171095Ssam * compilation 404171095Ssam * time. 405171095Ssam */ 406171095Ssam#define xge_assert(test) { \ 407173139Srwatson if (!(test)) xge_os_bug("bad cond: "#test" at %s:%d\n", \ 408171095Ssam __FILE__, __LINE__); } 409171095Ssam#else 410171095Ssam#define xge_assert(test) 411171095Ssam#endif /* end of XGE_DEBUG_ASSERT */ 412171095Ssam 413171095Ssam__EXTERN_END_DECLS 414171095Ssam 415171095Ssam#endif /* XGE_DEBUG_H */ 416