8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright (c) 2012 by Delphix. All rights reserved.
28 */
29
30 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
31 /* All Rights Reserved */
32
33 #ifndef _SYS_DEBUG_H
34 #define _SYS_DEBUG_H
35
36 #include <sys/isa_defs.h>
37 #include <sys/types.h>
38 #include <sys/note.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45 * ASSERT(ex) causes a panic or debugger entry if expression ex is not
46 * true. ASSERT() is included only for debugging, and is a no-op in
47 * production kernels. VERIFY(ex), on the other hand, behaves like
115 __FILE__, __LINE__); \
116 _NOTE(CONSTCOND) } while (0)
117
118 #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
119 #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
120 #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
121 #define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
122
123 #if DEBUG
124 #define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
125 #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
126 #define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
127 #define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
128 #else
129 #define ASSERT3S(x, y, z) ((void)0)
130 #define ASSERT3U(x, y, z) ((void)0)
131 #define ASSERT3P(x, y, z) ((void)0)
132 #define ASSERT0(x) ((void)0)
133 #endif
134
135 #ifdef _KERNEL
136
137 extern void abort_sequence_enter(char *);
138 extern void debug_enter(char *);
139
140 #endif /* _KERNEL */
141
142 #if defined(DEBUG) && !defined(__sun)
143 /* CSTYLED */
144 #define STATIC
145 #else
146 /* CSTYLED */
147 #define STATIC static
148 #endif
149
150 #ifdef __cplusplus
151 }
152 #endif
153
154 #endif /* _SYS_DEBUG_H */
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright (c) 2012 by Delphix. All rights reserved.
28 * Copyright 2013 Saso Kiselkov. All rights reserved.
29 */
30
31 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
32 /* All Rights Reserved */
33
34 #ifndef _SYS_DEBUG_H
35 #define _SYS_DEBUG_H
36
37 #include <sys/isa_defs.h>
38 #include <sys/types.h>
39 #include <sys/note.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /*
46 * ASSERT(ex) causes a panic or debugger entry if expression ex is not
47 * true. ASSERT() is included only for debugging, and is a no-op in
48 * production kernels. VERIFY(ex), on the other hand, behaves like
116 __FILE__, __LINE__); \
117 _NOTE(CONSTCOND) } while (0)
118
119 #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
120 #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
121 #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
122 #define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
123
124 #if DEBUG
125 #define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
126 #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
127 #define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
128 #define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
129 #else
130 #define ASSERT3S(x, y, z) ((void)0)
131 #define ASSERT3U(x, y, z) ((void)0)
132 #define ASSERT3P(x, y, z) ((void)0)
133 #define ASSERT0(x) ((void)0)
134 #endif
135
136 /*
137 * Compile-time assertion. The condition 'x' must be constant.
138 */
139 #define CTASSERT(x) _CTASSERT(x, __LINE__)
140 #define _CTASSERT(x, y) __CTASSERT(x, y)
141 #define __CTASSERT(x, y) \
142 typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1]
143
144 #ifdef _KERNEL
145
146 extern void abort_sequence_enter(char *);
147 extern void debug_enter(char *);
148
149 #endif /* _KERNEL */
150
151 #if defined(DEBUG) && !defined(__sun)
152 /* CSTYLED */
153 #define STATIC
154 #else
155 /* CSTYLED */
156 #define STATIC static
157 #endif
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif /* _SYS_DEBUG_H */
|