|
|
1.1 root 1: /*
2: * (c) Copyright 1992, 1993, 1994, 1995 OPEN SOFTWARE FOUNDATION, INC.
3: * ALL RIGHTS RESERVED
4: */
5: /*
6: * OSF RI nmk19b2 5/2/95
7: */
8:
9: /*
10: * File: ddb/tr.h
11: * Author: Alan Langerman, Jeffrey Heller
12: * Date: 1992
13: *
14: * Internal trace routines. Like old-style XPRs but
15: * less formatting.
16: */
17:
18: #include <mach_assert.h>
19: #include <mach_tr.h>
20:
21: /*
22: * Originally, we only wanted tracing when
23: * MACH_TR and MACH_ASSERT were turned on
24: * together. Now, there's no reason why
25: * MACH_TR and MACH_ASSERT can't be completely
26: * orthogonal.
27: */
28: #define TRACE_BUFFER (MACH_TR)
29:
30: /*
31: * Log events in a circular trace buffer for future debugging.
32: * Events are unsigned integers. Each event has a descriptive
33: * message.
34: *
35: * TR_DECL must be used at the beginning of a routine using
36: * one of the tr calls. The macro should be passed the name
37: * of the function surrounded by quotation marks, e.g.,
38: * TR_DECL("netipc_recv_intr");
39: * and should be terminated with a semi-colon. The TR_DECL
40: * must be the *last* declaration in the variable declaration
41: * list, or syntax errors will be introduced when TRACE_BUFFER
42: * is turned off.
43: */
44: #ifndef _DDB_TR_H_
45: #define _DDB_TR_H_
46:
47: #if TRACE_BUFFER
48:
49: #include <machine/db_machdep.h>
50:
51: #define __ui__ (unsigned int)
52: #define TR_INIT() tr_init()
53: #define TR_SHOW(a,b,c) show_tr((a),(b),(c))
54: #define TR_DECL(funcname) char *__ntr_func_name__ = funcname
55: #define tr1(msg) \
56: tr(__ntr_func_name__, __FILE__, __LINE__, (msg), \
57: 0,0,0,0)
58: #define tr2(msg,tag1) \
59: tr(__ntr_func_name__, __FILE__, __LINE__, (msg), \
60: __ui__(tag1),0,0,0)
61: #define tr3(msg,tag1,tag2) \
62: tr(__ntr_func_name__, __FILE__, __LINE__, (msg), \
63: __ui__(tag1),__ui__(tag2),0,0)
64: #define tr4(msg,tag1,tag2,tag3) \
65: tr(__ntr_func_name__, __FILE__, __LINE__, (msg), \
66: __ui__(tag1),__ui__(tag2),__ui__(tag3),0)
67: #define tr5(msg,tag1,tag2,tag3,tag4) \
68: tr(__ntr_func_name__, __FILE__, __LINE__, (msg), \
69: __ui__(tag1),__ui__(tag2),__ui__(tag3),__ui__(tag4))
70:
71: /*
72: * Adjust tr log indentation based on function
73: * call graph; this method is quick-and-dirty
74: * and only works safely on a uniprocessor.
75: */
76: extern int tr_indent;
77: #define tr_start() tr_indent++
78: #define tr_stop() tr_indent--
79:
80: extern void tr_init(void);
81: extern void tr(
82: char *funcname,
83: char *file,
84: unsigned int lineno,
85: char *fmt,
86: unsigned int tag1,
87: unsigned int tag2,
88: unsigned int tag3,
89: unsigned int tag4);
90:
91: extern void db_show_tr(
92: db_expr_t addr,
93: boolean_t have_addr,
94: db_expr_t count,
95: char * modif);
96:
97: #else /* TRACE_BUFFER */
98:
99: #define TR_INIT()
100: #define TR_SHOW(a,b,c)
101: #define TR_DECL(funcname)
102: #define tr1(msg)
103: #define tr2(msg, tag1)
104: #define tr3(msg, tag1, tag2)
105: #define tr4(msg, tag1, tag2, tag3)
106: #define tr5(msg, tag1, tag2, tag3, tag4)
107: #define tr_start()
108: #define tr_stop()
109:
110: #endif /* TRACE_BUFFER */
111:
112: #endif /* _DDB_TR_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.