Annotation of Gnu-Mach/util/debug.h, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * Copyright (c) 1995-1993 The University of Utah and
                      3:  * the Computer Systems Laboratory at the University of Utah (CSL).
                      4:  * All rights reserved.
                      5:  *
                      6:  * Permission to use, copy, modify and distribute this software is hereby
                      7:  * granted provided that (1) source code retains these copyright, permission,
                      8:  * and disclaimer notices, and (2) redistributions including binaries
                      9:  * reproduce the notices in supporting documentation, and (3) all advertising
                     10:  * materials mentioning features or use of this software display the following
                     11:  * acknowledgement: ``This product includes software developed by the
                     12:  * Computer Systems Laboratory at the University of Utah.''
                     13:  *
                     14:  * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
                     15:  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
                     16:  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     17:  *
                     18:  * CSL requests users of this software to return to [email protected] any
                     19:  * improvements that they make and grant CSL redistribution rights.
                     20:  *
                     21:  *      Author: Bryan Ford, University of Utah CSL
                     22:  */
                     23: /*
                     24:  *     File:   debug.h
                     25:  *     Author: Bryan Ford
                     26:  *
                     27:  *     This file contains definitions for kernel debugging,
                     28:  *     which are compiled in on the DEBUG symbol.
                     29:  *
                     30:  */
                     31: #ifndef _MACH_UTIL_DEBUG_H_
                     32: #define _MACH_UTIL_DEBUG_H_
                     33: 
                     34: #include <mach/macro_help.h>
                     35: 
                     36: 
                     37: #ifdef DEBUG
                     38: 
                     39: extern void panic(const char *fmt, ...);
                     40: 
                     41: #define here() printf("@ %s:%d\n", __FILE__, __LINE__)
                     42: #define message(args) ({ printf("@ %s:%d: ", __FILE__, __LINE__); printf args; printf("\n"); })
                     43: 
                     44: #define otsan() panic("%s:%d: off the straight and narrow!", __FILE__, __LINE__)
                     45: 
                     46: #define assert(v)                                                      \
                     47:        MACRO_BEGIN                                                     \
                     48:                if (!(v))                                               \
                     49:                        panic("%s:%d: failed assertion `"#v"'\n",       \
                     50:                                __FILE__, __LINE__);                    \
                     51:        MACRO_END
                     52: 
                     53: #define do_debug(stmt) stmt
                     54: 
                     55: #define debugmsg(args) \
                     56:        ({ printf("%s:%d: ", __FILE__, __LINE__); printf args; printf("\n"); })
                     57: 
                     58: #define struct_id_decl         unsigned struct_id;
                     59: #define struct_id_init(p,id)   ((p)->struct_id = (id))
                     60: #define struct_id_denit(p)     ((p)->struct_id = 0)
                     61: #define struct_id_verify(p,id) \
                     62:        ({ if ((p)->struct_id != (id)) \
                     63:                panic("%s:%d: "#p" (%08x) struct_id should be "#id" (%08x), is %08x\n", \
                     64:                        __FILE__, __LINE__, (p), (id), (p->struct_id)); \
                     65:        })
                     66: 
                     67: #else !DEBUG
                     68: 
                     69: #define otsan()
                     70: #define assert(v)
                     71: #define do_debug(stmt)
                     72: #define debugmsg(args)
                     73: 
                     74: #define struct_id_decl
                     75: #define struct_id_init(p,id)
                     76: #define struct_id_denit(p)
                     77: #define struct_id_verify(p,id)
                     78: 
                     79: #endif !DEBUG
                     80: 
                     81: #endif _MACH_UTIL_DEBUG_H_

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.