assert-r0drv-solaris.c revision 9c11b89c71ca727d975c39f2719063501ddcd03d
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - Assertion Workers, Ring-0 Drivers, Solaris.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * available from http://www.virtualbox.org. This file is free software;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * terms and conditions of either the GPL or the CDDL or both.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * additional information or have any questions.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*******************************************************************************
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync* Header Files *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync*******************************************************************************/
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/*******************************************************************************
8e034cd2a6b0c86697554278e970163287003bb9vboxsync* Global Variables *
8e034cd2a6b0c86697554278e970163287003bb9vboxsync*******************************************************************************/
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/** The last assert message, 1st part. */
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/** The last assert message, 2nd part. */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync/** The last assert message, expression. */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsyncRTDATADECL(const char * volatile) g_pszRTAssertExpr;
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/** The last assert message, file name. */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsyncRTDATADECL(const char * volatile) g_pszRTAssertFile;
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/** The last assert message, line number. */
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/** The last assert message, function name. */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsyncRTDATADECL(const char * volatile) g_pszRTAssertFunction;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncRTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync "Expression: %s\n"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync "Location : %s(%d) %s\n",
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Expression: %s\r\n"
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Location : %s(%d) %s\r\n",
8e034cd2a6b0c86697554278e970163287003bb9vboxsync RTStrPrintf(g_szRTAssertMsg1, sizeof(g_szRTAssertMsg1),
8e034cd2a6b0c86697554278e970163287003bb9vboxsync "\n!!Assertion Failed!!\n"
8e034cd2a6b0c86697554278e970163287003bb9vboxsync "Expression: %s\n"
8e034cd2a6b0c86697554278e970163287003bb9vboxsync "Location : %s(%d) %s\n",
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertExpr, (void *)pszExpr);
94a797b56cdb77ca5b26cb678b13144edc9ebb55vboxsync ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFile, (void *)pszFile);
94a797b56cdb77ca5b26cb678b13144edc9ebb55vboxsync ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFunction, (void *)pszFunction);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
8e034cd2a6b0c86697554278e970163287003bb9vboxsync RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, va);
8e034cd2a6b0c86697554278e970163287003bb9vboxsync const char *pszEnd = &g_szRTAssertMsg2[sizeof(g_szRTAssertMsg2)];
8e034cd2a6b0c86697554278e970163287003bb9vboxsync while (psz < pszEnd && (*psz == ' ' || *psz == '\t' || *psz == '\n' || *psz == '\r'))
8e034cd2a6b0c86697554278e970163287003bb9vboxsync assfail(psz, g_pszRTAssertFile, g_u32RTAssertLine);