VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp@ 4612

Last change on this file since 4612 was 4071, checked in by vboxsync, 18 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1/* $Id: assert-r0drv-darwin.cpp 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Assertion Workers, Ring-0 Drivers, Darwin.
4 */
5
6/*
7 * Copyright (C) 2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include "the-darwin-kernel.h"
23
24#include <iprt/assert.h>
25#include <iprt/log.h>
26#include <iprt/string.h>
27#include <iprt/stdarg.h>
28
29/*******************************************************************************
30* Global Variables *
31*******************************************************************************/
32/** The last assert message, 1st part. */
33RTDATADECL(char) g_szRTAssertMsg1[1024];
34/** The last assert message, 2nd part. */
35RTDATADECL(char) g_szRTAssertMsg2[2048];
36
37
38RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
39{
40#ifdef IN_GUEST_R0
41 RTLogBackdoorPrintf("\n!!Assertion Failed!!\n"
42 "Expression: %s\n"
43 "Location : %s(%d) %s\n",
44 pszExpr, pszFile, uLine, pszFunction);
45#endif
46
47 printf("\r\n!!Assertion Failed!!\r\n"
48 "Expression: %s\r\n"
49 "Location : %s(%d) %s\r\n",
50 pszExpr, pszFile, uLine, pszFunction);
51
52 RTStrPrintf(g_szRTAssertMsg1, sizeof(g_szRTAssertMsg1),
53 "\n!!Assertion Failed!!\n"
54 "Expression: %s\n"
55 "Location : %s(%d) %s\n",
56 pszExpr, pszFile, uLine, pszFunction);
57}
58
59
60RTDECL(void) AssertMsg2(const char *pszFormat, ...)
61{
62 va_list va;
63 char szMsg[256];
64
65#ifdef IN_GUEST_R0
66 va_start(va, pszFormat);
67 RTLogBackdoorPrintfV(pszFormat, va);
68 va_end(va);
69#endif
70
71 va_start(va, pszFormat);
72 RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
73 szMsg[sizeof(szMsg) - 1] = '\0';
74 va_end(va);
75 printf("%s", szMsg);
76
77 va_start(va, pszFormat);
78 RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, va);
79 va_end(va);
80
81 panic("%s%s", g_szRTAssertMsg1, g_szRTAssertMsg2);
82}
83
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette