ia64/xen-unstable

diff xen/include/xen/lib.h @ 3827:33647e6b3f4e

bitkeeper revision 1.1200 (42107fffsY27L01xietRjdMzGHiDzw)

x86/64 build fixes and simpler debug tracing.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Mon Feb 14 10:39:59 2005 +0000 (2005-02-14)
parents 0a4b76b6b5a0
children 786c05f5b537 ac04aeeaf462
line diff
     1.1 --- a/xen/include/xen/lib.h	Mon Feb 14 02:27:01 2005 +0000
     1.2 +++ b/xen/include/xen/lib.h	Mon Feb 14 10:39:59 2005 +0000
     1.3 @@ -2,11 +2,18 @@
     1.4  #define __LIB_H__
     1.5  
     1.6  #include <stdarg.h>
     1.7 +#include <xen/config.h>
     1.8  #include <xen/types.h>
     1.9  #include <xen/string.h>
    1.10  
    1.11 +#define BUG() do {					\
    1.12 +    printk("BUG at %s:%d\n", __FILE__, __LINE__);	\
    1.13 +    debugtrace_dump();                                  \
    1.14 +    FORCE_CRASH();                                      \
    1.15 +} while ( 0 )
    1.16 +
    1.17  #ifndef NDEBUG
    1.18 -#define ASSERT(_p) if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); *(int*)0=0; }
    1.19 +#define ASSERT(_p) if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); }
    1.20  #else
    1.21  #define ASSERT(_p) ((void)0)
    1.22  #endif
    1.23 @@ -20,6 +27,16 @@ struct domain;
    1.24  
    1.25  void cmdline_parse(char *cmdline);
    1.26  
    1.27 +#ifndef NDEBUG
    1.28 +extern void debugtrace_reset(void);
    1.29 +extern void debugtrace_dump(void);
    1.30 +extern void debugtrace_printk(const char *fmt, ...);
    1.31 +#else
    1.32 +#define debugtrace_reset()         ((void)0)
    1.33 +#define debugtrace_dump()          ((void)0)
    1.34 +#define debugtrace_printk(_f, ...) ((void)0)
    1.35 +#endif
    1.36 +
    1.37  #define printk printf
    1.38  void printf(const char *format, ...);
    1.39  void panic(const char *format, ...);