debug.h (179198) | debug.h (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the | 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. | 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance 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/* | 7 * 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/* |
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 27/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28/* All Rights Reserved */ 29 30 31#ifndef _SYS_DEBUG_H 32#define _SYS_DEBUG_H 33 | 23 * Use is subject to license terms. 24 */ 25 26/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 27/* All Rights Reserved */ 28 29 30#ifndef _SYS_DEBUG_H 31#define _SYS_DEBUG_H 32 |
34#pragma ident "%Z%%M% %I% %E% SMI" 35 | |
36#include <sys/types.h> 37 38#ifdef __cplusplus 39extern "C" { 40#endif 41 42/* 43 * ASSERT(ex) causes a panic or debugger entry if expression ex is not 44 * true. ASSERT() is included only for debugging, and is a no-op in 45 * production kernels. VERIFY(ex), on the other hand, behaves like 46 * ASSERT and is evaluated on both debug and non-debug kernels. 47 */ 48 49#if defined(__STDC__) 50extern int assfail(const char *, const char *, int); 51#define VERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__))) 52#ifdef DEBUG | 33#include <sys/types.h> 34 35#ifdef __cplusplus 36extern "C" { 37#endif 38 39/* 40 * ASSERT(ex) causes a panic or debugger entry if expression ex is not 41 * true. ASSERT() is included only for debugging, and is a no-op in 42 * production kernels. VERIFY(ex), on the other hand, behaves like 43 * ASSERT and is evaluated on both debug and non-debug kernels. 44 */ 45 46#if defined(__STDC__) 47extern int assfail(const char *, const char *, int); 48#define VERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__))) 49#ifdef DEBUG |
53#define ASSERT(EX) VERIFY(EX) | 50#define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__))) |
54#else 55#define ASSERT(x) ((void)0) 56#endif 57#else /* defined(__STDC__) */ 58extern int assfail(); 59#define VERIFY(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__))) 60#ifdef DEBUG | 51#else 52#define ASSERT(x) ((void)0) 53#endif 54#else /* defined(__STDC__) */ 55extern int assfail(); 56#define VERIFY(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__))) 57#ifdef DEBUG |
61#define ASSERT(EX) VERIFY(EX) | 58#define ASSERT(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__))) |
62#else 63#define ASSERT(x) ((void)0) 64#endif 65#endif /* defined(__STDC__) */ 66 67/* 68 * Assertion variants sensitive to the compilation data model 69 */ --- 23 unchanged lines hidden (view full) --- 93 (uintmax_t)__left, #OP, (uintmax_t)__right, \ 94 __FILE__, __LINE__); \ 95_NOTE(CONSTCOND) } while (0) 96 97#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) 98#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) 99#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) 100#ifdef DEBUG | 59#else 60#define ASSERT(x) ((void)0) 61#endif 62#endif /* defined(__STDC__) */ 63 64/* 65 * Assertion variants sensitive to the compilation data model 66 */ --- 23 unchanged lines hidden (view full) --- 90 (uintmax_t)__left, #OP, (uintmax_t)__right, \ 91 __FILE__, __LINE__); \ 92_NOTE(CONSTCOND) } while (0) 93 94#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) 95#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) 96#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) 97#ifdef DEBUG |
101#define ASSERT3S(x, y, z) VERIFY3S(x, y, z) 102#define ASSERT3U(x, y, z) VERIFY3U(x, y, z) 103#define ASSERT3P(x, y, z) VERIFY3P(x, y, z) | 98#define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) 99#define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) 100#define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) |
104#else 105#define ASSERT3S(x, y, z) ((void)0) 106#define ASSERT3U(x, y, z) ((void)0) 107#define ASSERT3P(x, y, z) ((void)0) 108#endif 109 110#ifdef _KERNEL 111 --- 18 unchanged lines hidden --- | 101#else 102#define ASSERT3S(x, y, z) ((void)0) 103#define ASSERT3U(x, y, z) ((void)0) 104#define ASSERT3P(x, y, z) ((void)0) 105#endif 106 107#ifdef _KERNEL 108 --- 18 unchanged lines hidden --- |