|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1993,1994 The University of Utah and ! 3: * the Computer Systems Laboratory (CSL). All rights reserved. ! 4: * ! 5: * Permission to use, copy, modify and distribute this software and its ! 6: * documentation is hereby granted, provided that both the copyright ! 7: * notice and this permission notice appear in all copies of the ! 8: * software, derivative works or modified versions, and any portions ! 9: * thereof, and that both notices appear in supporting documentation. ! 10: * ! 11: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS ! 12: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF ! 13: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 14: * ! 15: * CSL requests users of this software to return to [email protected] any ! 16: * improvements that they make and grant CSL redistribution rights. ! 17: * ! 18: * Author: Bryan Ford, University of Utah CSL ! 19: */ ! 20: /* ! 21: * File: debug.h ! 22: * Author: Bryan Ford ! 23: * ! 24: * This file contains definitions for kernel debugging, ! 25: * which are compiled in on the DEBUG symbol. ! 26: * ! 27: */ ! 28: #ifndef _mach_debug__debug_ ! 29: #define _mach_debug__debug_ ! 30: ! 31: #include <kern/assert.h> /*XXX*/ ! 32: ! 33: #ifdef DEBUG ! 34: ! 35: #define here() printf("@ %s:%d\n", __FILE__, __LINE__) ! 36: #define message(args) ({ printf("@ %s:%d: ", __FILE__, __LINE__); printf args; printf("\n"); }) ! 37: ! 38: #define otsan() panic("%s:%d: off the straight and narrow!", __FILE__, __LINE__) ! 39: ! 40: #define struct_id_decl unsigned struct_id; ! 41: #define struct_id_init(p,id) ((p)->struct_id = (id)) ! 42: #define struct_id_denit(p) ((p)->struct_id = 0) ! 43: #define struct_id_verify(p,id) \ ! 44: ({ if ((p)->struct_id != (id)) \ ! 45: panic("%s:%d: "#p" (%08x) struct_id should be "#id" (%08x), is %08x\n", \ ! 46: __FILE__, __LINE__, (p), (id), (p->struct_id)); \ ! 47: }) ! 48: ! 49: #else !DEBUG ! 50: ! 51: #define otsan() ! 52: ! 53: #define struct_id_decl ! 54: #define struct_id_init(p,id) ! 55: #define struct_id_denit(p) ! 56: #define struct_id_verify(p,id) ! 57: ! 58: #endif !DEBUG ! 59: ! 60: #endif _mach_debug__debug_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.