assert.cpp revision 760e27ea38bd47048a383cdfc6aa78d1a1637363
/* $Id$ */
/** @file
* innotek Portable Runtime - Assertion Workers.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#ifdef IN_RING3
# include <stdio.h>
#endif
#ifdef IN_GUEST_R0
/**
* The 1st part of an assert message.
*
* @param pszExpr Expression. Can be NULL.
* @param uLine Location line number.
* @param pszFile Location file name.
* @param pszFunction Location function name.
* @remark This API exists in HC Ring-3 and GC.
*/
RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
RTLogBackdoorPrintf("\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
}
/**
* The 2nd (optional) part of an assert message.
*
* @param pszFormat Printf like format string.
* @param ... Arguments to that string.
* @remark This API exists in HC Ring-3 and GC.
*/
{ /* forwarder. */
}
#if defined(RT_OS_LINUX) && defined(IN_MODULE)
/*
* When we build this in the Linux kernel module, we wish to make the
* symbols available to other modules as well.
*/
# include "the-linux-kernel.h"
#endif
/* OS specific. */
#else /* !IN_RING0 */
/** The last assert message, 1st part. */
/** The last assert message, 2nd part. */
/**
* The 1st part of an assert message.
*
* @param pszExpr Expression. Can be NULL.
* @param uLine Location line number.
* @param pszFile Location file name.
* @param pszFunction Location function name.
* @remark This API exists in HC Ring-3 and GC.
*/
RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
#if !defined(IN_RING3) && !defined(LOG_NO_COM)
RTLogComPrintf("\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
#endif
if (pLog)
{
RTLogRelPrintf("\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
}
pLog = RTLogDefaultInstance();
if (pLog)
{
RTLogPrintf("\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
}
#ifdef IN_RING3
/* print to stderr, helps user and gdb debugging. */
"\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
#endif
"\n!!Assertion Failed!!\n"
"Expression: %s\n"
"Location : %s(%d) %s\n",
}
/**
* The 2nd (optional) part of an assert message.
*
* @param pszFormat Printf like format string.
* @param ... Arguments to that string.
* @remark This API exists in HC Ring-3 and GC.
*/
{
#if !defined(IN_RING3) && !defined(LOG_NO_COM)
#endif
if (pLog)
{
}
pLog = RTLogDefaultInstance();
if (pLog)
{
}
#ifdef IN_RING3
/* print to stderr, helps user and gdb debugging. */
char szMsg[1024];
#endif
}
#endif /* !IN_RING0 */