|
|
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: #include <oskit/gdb.h>
34: #define Debugger(msg) ({gdb_breakpoint(); panic(msg);})
35:
36: #ifdef DEBUG
37:
38: #define here() printf("@ %s:%d\n", __FILE__, __LINE__)
39: #define message(args) ({ printf("@ %s:%d: ", __FILE__, __LINE__); printf args; printf("\n"); })
40:
41: #define otsan() panic("%s:%d: off the straight and narrow!", __FILE__, __LINE__)
42:
43: #define struct_id_decl unsigned struct_id;
44: #define struct_id_init(p,id) ((p)->struct_id = (id))
45: #define struct_id_denit(p) ((p)->struct_id = 0)
46: #define struct_id_verify(p,id) \
47: ({ if ((p)->struct_id != (id)) \
48: panic("%s:%d: "#p" (%08x) struct_id should be "#id" (%08x), is %08x\n", \
49: __FILE__, __LINE__, (p), (id), (p->struct_id)); \
50: })
51:
52: #else /* !DEBUG */
53:
54: #define otsan()
55:
56: #define struct_id_decl
57: #define struct_id_init(p,id)
58: #define struct_id_denit(p)
59: #define struct_id_verify(p,id)
60:
61: #endif /* !DEBUG */
62:
63: #endif /* _mach_debug__debug_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.