xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_debug.h (revision cd61ae21816e53b94bc1673f3f1aa651fc3115e8)
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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 #include <stdarg.h>
36 
37 #define	MDB_DBG_CMDBUF	0x00000001
38 #define	MDB_DBG_PARSER	0x00000002
39 #define	MDB_DBG_HELP	0x00000004
40 #define	MDB_DBG_MODULE	0x00000008
41 #define	MDB_DBG_DCMD	0x00000010
42 #define	MDB_DBG_ELF	0x00000020
43 #define	MDB_DBG_MACH	0x00000040
44 #define	MDB_DBG_SHELL	0x00000080
45 #define	MDB_DBG_KMOD	0x00000100
46 #define	MDB_DBG_WALK	0x00000200
47 #define	MDB_DBG_UMEM	0x00000400
48 #define	MDB_DBG_DSTK	0x00000800
49 #define	MDB_DBG_TGT	0x00001000
50 #define	MDB_DBG_PSVC	0x00002000
51 #define	MDB_DBG_PROC	0x00004000
52 #define	MDB_DBG_CTF	0x00008000
53 #define	MDB_DBG_DPI	0x00010000
54 #define	MDB_DBG_KDI	0x00020000
55 #define	MDB_DBG_CALLB	0x00040000
56 
57 #ifdef _MDB
58 
59 extern void mdb_dprintf(uint_t, const char *, ...);
60 extern void mdb_dvprintf(uint_t, const char *, va_list);
61 
62 extern uint_t mdb_dstr2mode(const char *);
63 extern void mdb_dmode(uint_t);
64 
65 extern const char *mdb_err2str(int);
66 
67 extern int mdb_dassert(const char *, const char *, int);
68 #ifdef DEBUG
69 #define	ASSERT(x)	((void)((x) || mdb_dassert(#x, __FILE__, __LINE__)))
70 #else
71 #define	ASSERT(x)
72 #endif
73 
74 #endif /* _MDB */
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _MDB_DEBUG_H */
81