29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/* $Id$ */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/** @file
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - Assertion Workers, Ring-0 Drivers, Solaris.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2011 Oracle Corporation
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync *
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 *
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 *
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.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*******************************************************************************
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync* Header Files *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync*******************************************************************************/
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include "the-solaris-kernel.h"
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync#include "internal/iprt.h"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/assert.h>
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync#include <iprt/asm.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/log.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/stdarg.h>
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync#include <iprt/string.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync#include "internal/assert.h"
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync{
089c21a647af46044cad04a78cfdcfae814d2105vboxsync uprintf("\r\n!!Assertion Failed!!\r\n"
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Expression: %s\r\n"
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Location : %s(%d) %s\r\n",
089c21a647af46044cad04a78cfdcfae814d2105vboxsync pszExpr, pszFile, uLine, pszFunction);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync}
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync{
4b37aac42309dbacba7ff11f16ed8d72a06b71e4vboxsync char szMsg[256];
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync szMsg[sizeof(szMsg) - 1] = '\0';
089c21a647af46044cad04a78cfdcfae814d2105vboxsync uprintf("%s", szMsg);
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsync
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsync NOREF(fInitial);
8e034cd2a6b0c86697554278e970163287003bb9vboxsync}
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
8e034cd2a6b0c86697554278e970163287003bb9vboxsyncRTR0DECL(void) RTR0AssertPanicSystem(void)
8e034cd2a6b0c86697554278e970163287003bb9vboxsync{
8e034cd2a6b0c86697554278e970163287003bb9vboxsync const char *psz = &g_szRTAssertMsg2[0];
8e034cd2a6b0c86697554278e970163287003bb9vboxsync const char *pszEnd = &g_szRTAssertMsg2[sizeof(g_szRTAssertMsg2)];
8e034cd2a6b0c86697554278e970163287003bb9vboxsync while (psz < pszEnd && (*psz == ' ' || *psz == '\t' || *psz == '\n' || *psz == '\r'))
8e034cd2a6b0c86697554278e970163287003bb9vboxsync psz++;
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
26160a583507a31755f24f87663ce91a2b327036vboxsync if (psz < pszEnd && *psz)
8e034cd2a6b0c86697554278e970163287003bb9vboxsync assfail(psz, g_pszRTAssertFile, g_u32RTAssertLine);
8e034cd2a6b0c86697554278e970163287003bb9vboxsync else
8e034cd2a6b0c86697554278e970163287003bb9vboxsync assfail(g_szRTAssertMsg1, g_pszRTAssertFile, g_u32RTAssertLine);
2c203bb219df5391ed7f3888c85e12a4e47817davboxsync g_szRTAssertMsg2[0] = '\0';
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync}
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync