xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_debug.h (revision e4f5a11d4a234623168c1558fcdf4341e11769e1)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_DEBUG_H
28 #define	_MDB_DEBUG_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <stdarg.h>
38 
39 #define	MDB_DBG_CMDBUF	0x00000001
40 #define	MDB_DBG_PARSER	0x00000002
41 #define	MDB_DBG_HELP	0x00000004
42 #define	MDB_DBG_MODULE	0x00000008
43 #define	MDB_DBG_DCMD	0x00000010
44 #define	MDB_DBG_ELF	0x00000020
45 #define	MDB_DBG_MACH	0x00000040
46 #define	MDB_DBG_SHELL	0x00000080
47 #define	MDB_DBG_KMOD	0x00000100
48 #define	MDB_DBG_WALK	0x00000200
49 #define	MDB_DBG_UMEM	0x00000400
50 #define	MDB_DBG_DSTK	0x00000800
51 #define	MDB_DBG_TGT	0x00001000
52 #define	MDB_DBG_PSVC	0x00002000
53 #define	MDB_DBG_PROC	0x00004000
54 #define	MDB_DBG_CTF	0x00008000
55 #define	MDB_DBG_DPI	0x00010000
56 #define	MDB_DBG_KDI	0x00020000
57 #define	MDB_DBG_CALLB	0x00040000
58 
59 #ifdef _MDB
60 
61 extern void mdb_dprintf(uint_t, const char *, ...);
62 extern void mdb_dvprintf(uint_t, const char *, va_list);
63 
64 extern uint_t mdb_dstr2mode(const char *);
65 extern void mdb_dmode(uint_t);
66 
67 extern const char *mdb_err2str(int);
68 
69 #ifdef DEBUG
70 extern int mdb_dassert(const char *, const char *, int);
71 #define	ASSERT(x)	((void)((x) || mdb_dassert(#x, __FILE__, __LINE__)))
72 #else
73 #define	ASSERT(x)
74 #endif
75 
76 #endif /* _MDB */
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _MDB_DEBUG_H */
83