VirtualBox

Changeset 14500

Show
Ignore:
Timestamp:
11/24/08 03:22:08 (2 months ago)
Author:
vboxsync
Message:

IPRT/SUPDrv/VMM: Made RTR0AssertPanicSystem available to VMMR0.r0 on darwin & solaris (only platforms implemting it currently). Created RTAssertMsg1, RTAssertMsg2 and RTAssertMsg2V (darwin only atm) in addition to AssertMsg?1/2 and delcared the latter two as weak and overridable by users, while the former are strong and exposed by SUPDrv. This way we can get the full assertion text in the 'Problem Report for Mac OS X Kernel' thing. Will propagte the changes to the other platforms and rings later.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/iprt/assert.h

    r13931 r14500  
    3333#include <iprt/cdefs.h> 
    3434#include <iprt/types.h> 
     35#include <iprt/stdarg.h> 
    3536 
    3637/** @defgroup grp_rt_assert     Assert - Assertions 
     
    8687 * @param   pszFile     Location file name. 
    8788 * @param   pszFunction Location function name. 
    88  * @remark  This API exists in HC Ring-3 and GC. 
     89 */ 
     90RTDECL(void)    RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction); 
     91/** 
     92 * Weak version of RTAssertMsg1 
     93 * 
     94 * @copydoc RTAssertMsg1 
     95 * @todo rename to AssertMsg1Weak 
    8996 */ 
    9097RTDECL(void)    AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction); 
     
    9299/** 
    93100 * The 2nd (optional) part of an assert message. 
     101 * 
     102 * @param   pszFormat   Printf like format string. 
     103 * @param   va          Arguments to that string. 
     104 */ 
     105RTDECL(void)    RTAssertMsg2V(const char *pszFormat, va_list va); 
     106 
     107/** 
     108 * The 2nd (optional) part of an assert message. 
     109 * 
    94110 * @param   pszFormat   Printf like format string. 
    95111 * @param   ...         Arguments to that string. 
    96  * @remark  This API exists in HC Ring-3 and GC. 
     112 */ 
     113RTDECL(void)    RTAssertMsg2(const char *pszFormat, ...); 
     114/** Weak version of RTAssertMsg2 
     115 * @copydoc RTAssertMsg2 
     116 * @todo rename to AssertMsg2Weak 
    97117 */ 
    98118RTDECL(void)    AssertMsg2(const char *pszFormat, ...); 
     
    294314 * @remarks This macro does not depend on RT_STRICT. 
    295315 */ 
    296 #if (defined(IN_RING0) && !defined(IN_RING0_AGNOSTIC)) \ 
     316#if defined(IN_RING0) \ 
    297317 && (defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)) 
    298318# define RTAssertDoPanic()      RTR0AssertPanicSystem() 
  • trunk/src/VBox/Runtime/Makefile.kmk

    r14468 r14500  
    879879        common/misc/sanity-c.c \ 
    880880        common/misc/sanity-cpp.cpp \ 
     881        common/misc/RTAssertMsg2.cpp \ 
    881882        common/string/strformat.cpp \ 
    882883        common/string/strformatrt.cpp \ 
     
    960961RuntimeR0Drv_SOURCES    = \ 
    961962        common/alloc/alloc.cpp \ 
     963        common/misc/RTAssertMsg2.cpp \ 
    962964        common/checksum/crc32.cpp \ 
    963965        common/checksum/crc64.cpp \ 
     
    10721074RuntimeR0Drv_SOURCES.darwin = \ 
    10731075        common/err/RTErrConvertFromErrno.cpp \ 
     1076        common/misc/RTAssertMsg1Weak.cpp \ 
     1077        common/misc/RTAssertMsg2Weak.cpp \ 
    10741078        common/misc/thread.cpp \ 
    10751079        common/string/memchr.asm \ 
  • trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp

    r13314 r14500  
    5959 
    6060 
    61 RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 
     61RTDECL(void) RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 
    6262{ 
    6363#ifdef IN_GUEST_R0 
     
    8585 
    8686 
    87 RTDECL(void) AssertMsg2(const char *pszFormat, ...
     87RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va
    8888{ 
    89     va_list va
     89    va_list vaCopy
    9090    char    szMsg[256]; 
    9191 
    9292#ifdef IN_GUEST_R0 
    93     va_start(va, pszFormat); 
    94     RTLogBackdoorPrintfV(pszFormat, va); 
    95     va_end(va); 
     93    va_copy(vaCopy, va); 
     94    RTLogBackdoorPrintfV(pszFormat, vaCopy); 
     95    va_end(vaCopy); 
    9696#endif 
    9797 
    98     va_start(va, pszFormat); 
    99     RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va); 
     98    va_copy(vaCopy, va); 
     99    RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, vaCopy); 
    100100    szMsg[sizeof(szMsg) - 1] = '\0'; 
    101     va_end(va); 
     101    va_end(vaCopy); 
    102102    printf("%s", szMsg); 
    103103 
    104     va_start(va, pszFormat); 
    105     RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, va); 
    106     va_end(va); 
     104    va_copy(vaCopy, va); 
     105    RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, vaCopy); 
     106    va_end(vaCopy); 
    107107} 
    108108 
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r14499 r14500  
    11781178DECLEXPORT(void) RTCALL AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 
    11791179{ 
    1180 #ifndef DEBUG_sandervl 
     1180#if !defined(DEBUG_sandervl) && !defined(RT_OS_DARWIN) 
    11811181    SUPR0Printf("\n!!R0-Assertion Failed!!\n" 
    11821182                "Expression: %s\n" 
     
    11961196                    "Location  : %s(%d) %s\n", 
    11971197                    pszExpr, pszFile, uLine, pszFunction); 
     1198#ifdef RT_OS_DARWIN 
     1199    RTAssertMsg1(pszExpr, uLine, pszFile, pszFunction); 
     1200#endif 
    11981201} 
    11991202 
     
    12071210    for (size_t i = 0; i < cbChars; i++) 
    12081211    { 
    1209 #ifndef DEBUG_sandervl 
     1212#if !defined(DEBUG_sandervl) && !defined(RT_OS_DARWIN) 
    12101213        SUPR0Printf("%c", pachChars[i]); 
    12111214#endif 
     
    12191222DECLEXPORT(void) RTCALL AssertMsg2(const char *pszFormat, ...) 
    12201223{ 
     1224    va_list va; 
     1225 
    12211226    PRTLOGGER pLog = RTLogDefaultInstance(); /** @todo we want this for release as well! */ 
    12221227    if (pLog) 
    12231228    { 
    1224         va_list va; 
    12251229        va_start(va, pszFormat); 
    12261230        RTLogFormatV(rtLogOutput, pLog, pszFormat, va); 
     
    12351239        } 
    12361240    } 
    1237 
    1238  
     1241 
     1242#ifdef RT_OS_DARWIN 
     1243    va_start(va, pszFormat); 
     1244    RTAssertMsg2V(pszFormat, va); 
     1245    va_end(va); 
     1246#endif 
     1247
     1248 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy