VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp@ 11916

最後變更 在這個檔案從11916是 11916,由 vboxsync 提交於 17 年 前

assert-r0drv-nt: just do the same as everyone else.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.2 KB
 
1/* $Id: assert-r0drv-nt.cpp 11916 2008-09-01 12:54:21Z vboxsync $ */
2/** @file
3 * IPRT - Assertion Workers, Ring-0 Drivers, NT.
4 */
5
6/*
7 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31/*******************************************************************************
32* Header Files *
33*******************************************************************************/
34#include "the-nt-kernel.h"
35
36#include <iprt/assert.h>
37#include <iprt/log.h>
38#include <iprt/string.h>
39#include <iprt/stdarg.h>
40
41
42/*******************************************************************************
43* Global Variables *
44*******************************************************************************/
45/** The last assert message, 1st part. */
46RTDATADECL(char) g_szRTAssertMsg1[1024];
47/** The last assert message, 2nd part. */
48RTDATADECL(char) g_szRTAssertMsg2[2048];
49
50
51RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
52{
53#ifdef IN_GUEST_R0
54 RTLogBackdoorPrintf("\n!!Assertion Failed!!\n"
55 "Expression: %s\n"
56 "Location : %s(%d) %s\n",
57 pszExpr, pszFile, uLine, pszFunction);
58#endif
59
60 DbgPrint("\n!!Assertion Failed!!\n"
61 "Expression: %s\n"
62 "Location : %s(%d) %s\n",
63 pszExpr, pszFile, uLine, pszFunction);
64
65 RTStrPrintf(g_szRTAssertMsg1, sizeof(g_szRTAssertMsg1),
66 "\n!!Assertion Failed!!\n"
67 "Expression: %s\n"
68 "Location : %s(%d) %s\n",
69 pszExpr, pszFile, uLine, pszFunction);
70}
71
72
73RTDECL(void) AssertMsg2(const char *pszFormat, ...)
74{
75 va_list va;
76 char szMsg[256];
77
78# ifdef IN_GUEST_R0
79 va_start(va, pszFormat);
80 RTLogBackdoorPrintfV(pszFormat, va);
81 va_end(va);
82# endif
83
84 va_start(va, pszFormat);
85 RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
86 szMsg[sizeof(szMsg) - 1] = '\0';
87 va_end(va);
88 DbgPrint("%s", szMsg);
89
90 va_start(va, pszFormat);
91 RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, va);
92 va_end(va);
93}
94
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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