VirtualBox

Changeset 13314

Show
Ignore:
Timestamp:
10/16/08 00:46:08 (3 months ago)
Author:
vboxsync
Message:

Created assert-r0drv-linux.c (finally).

Files:

Legend:

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

    r13311 r13314  
    126126#endif 
    127127 
     128/** @name Globals for crash analysis 
     129 * @remarks     This is the full potential set, it 
     130 * @{ 
     131 */ 
    128132/** The last assert message, 1st part. */ 
    129 extern RTDATADECL(char) g_szRTAssertMsg1[1024]; 
     133extern RTDATADECL(char)                     g_szRTAssertMsg1[1024]; 
    130134/** The last assert message, 2nd part. */ 
    131 extern RTDATADECL(char) g_szRTAssertMsg2[2048]; 
     135extern RTDATADECL(char)                     g_szRTAssertMsg2[2048]; 
     136/** The last assert message, expression. */ 
     137extern RTDATADECL(const char * volatile)    g_pszRTAssertExpr; 
     138/** The last assert message, file name. */ 
     139extern RTDATADECL(const char * volatile)    g_pszRTAssertFile; 
     140/** The last assert message, line number. */ 
     141extern RTDATADECL(uint32_t volatile)        g_u32RTAssertLine; 
     142/** The last assert message, function name. */ 
     143extern RTDATADECL(const char * volatile)    g_pszRTAssertFunction; 
     144/** @} */ 
    132145 
    133146__END_DECLS 
  • trunk/src/VBox/Additions/linux/module/Makefile.module

    r11876 r13314  
    7171        r0drv/alloc-r0drv.o \ 
    7272        r0drv/linux/alloc-r0drv-linux.o \ 
     73        r0drv/linux/assert-r0drv-linux.o \ 
    7374        r0drv/linux/semevent-r0drv-linux.o \ 
    7475        r0drv/linux/semfastmutex-r0drv-linux.o \ 
     
    7980        umoddi3.o \ 
    8081        qdivrem.o \ 
    81         assert.o \ 
    8282        logbackdoor.o \ 
    8383        logformat.o \ 
     
    8585        strformatrt.o \ 
    8686        strformattype.o \ 
    87         strformat-vbox.o 
     87        strformat-vbox.o \ 
     88    RTAssertShouldPanic-generic.o 
    8889ifeq ($(BUILD_TARGET_ARCH),amd64) 
    8990OBJS += \ 
  • trunk/src/VBox/Additions/linux/module/files_vboxadd

    r11519 r13314  
    6666    ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>udivdi3.c \ 
    6767    ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>umoddi3.c \ 
    68     ${PATH_ROOT}/src/VBox/Runtime/common/misc/assert.cpp=>assert.c \ 
    6968    ${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>strformat.c \ 
    7069    ${PATH_ROOT}/src/VBox/Runtime/common/string/strformatrt.cpp=>strformatrt.c \ 
    7170    ${PATH_ROOT}/src/VBox/Runtime/common/string/strformattype.cpp=>strformattype.c \ 
     71    ${PATH_ROOT}/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp=>RTAssertShouldPanic-generic.cpp \ 
    7272    ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \ 
    7373    ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.h=>r0drv/alloc-r0drv.h \ 
    7474    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c=>r0drv/linux/alloc-r0drv-linux.c \ 
     75    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c=>r0drv/linux/assert-r0drv-linux.c \ 
    7576    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c=>r0drv/linux/semevent-r0drv-linux.c \ 
    7677    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c=>r0drv/linux/semeventmulti-r0drv-linux.c \ 
  • trunk/src/VBox/Additions/linux/module/vboxmod.c

    r12280 r13314  
    11/** @file 
    2  * 
    32 * vboxadd -- VirtualBox Guest Additions for Linux 
    43 */ 
     
    8584#endif 
    8685 
    87 /* This is called by our assert macros to find out whether we want 
    88    to insert a breakpoint after the assertion. In kernel modules we 
    89    do not of course. */ 
    90 RTDECL(bool)    RTAssertDoBreakpoint(void) 
    91 { 
    92     return false; 
    93 } 
    94 EXPORT_SYMBOL(RTAssertDoBreakpoint); 
    95  
    9686/** device extension structure (we only support one device instance) */ 
    9787static VBoxDevice *vboxDev = NULL; 
     
    115105EXPORT_SYMBOL (vboxadd_cmc_open); 
    116106EXPORT_SYMBOL (vboxadd_cmc_close); 
     107 
     108/** @todo check that this works for all the kernels. */ 
     109EXPORT_SYMBOL (RTR0AssertPanicSystem); 
     110EXPORT_SYMBOL (RTAssertShouldPanic); 
     111EXPORT_SYMBOL (AssertMsg1); 
     112EXPORT_SYMBOL (AssertMsg2); 
     113 
    117114 
    118115#define MAX_HGCM_CONNECTIONS 1024 
     
    599596 
    600597/** 
    601  * Dummy read function - we only supply this because we implement poll and  
     598 * Dummy read function - we only supply this because we implement poll and 
    602599 * fasync. 
    603600 */ 
     
    11671164MODULE_DEVICE_TABLE(pci, vmmdev_pci_id); 
    11681165 
    1169 int __gxx_personality_v0 = 0xdeadbeef; 
     1166 
    11701167 
    11711168/* 
     
    11761173 * End: 
    11771174 */ 
     1175 
  • trunk/src/VBox/HostDrivers/Support/linux/Makefile

    r13306 r13314  
    7777        r0drv/memobj-r0drv.o \ 
    7878        r0drv/mpnotification-r0drv.o \ 
     79        r0drv/linux/assert-r0drv-linux.o \ 
    7980        r0drv/linux/alloc-r0drv-linux.o \ 
    8081        r0drv/linux/initterm-r0drv-linux.o \ 
     
    9192        r0drv/linux/timer-r0drv-linux.o \ 
    9293        common/err/RTErrConvertFromErrno.o \ 
    93         generic/RTAssertShouldPanic-generic.o 
    94 ifeq ($(BUILD_TARGET_ARCH),x86) 
    95 OBJS += math/gcc/divdi3.o \ 
    96         math/gcc/moddi3.o \ 
    97         math/gcc/qdivrem.o \ 
    98         math/gcc/udivdi3.o 
    99 endif 
    100 ifeq ($(BUILD_TARGET_ARCH),amd64) 
    101 OBJS += alloc/heapsimple.o 
    102 endif 
    103  
    104 ifeq ($(BUILD_TYPE),debug) 
    105 OBJS += common/log/log.o \ 
     94        common/log/log.o \ 
    10695        common/log/logellipsis.o \ 
    10796        common/log/logrel.o \ 
     
    115104        common/string/strtonum.o \ 
    116105        r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \ 
     106        generic/RTAssertShouldPanic-generic.o \ 
    117107        generic/RTLogWriteStdErr-stub-generic.o \ 
    118108        generic/RTLogWriteStdOut-stub-generic.o \ 
     
    122112ifeq ($(BUILD_TARGET_ARCH),x86) 
    123113OBJS += math/gcc/divdi3.o \ 
     114        math/gcc/moddi3.o \ 
     115        math/gcc/qdivrem.o \ 
     116        math/gcc/udivdi3.o \ 
     117        math/gcc/divdi3.o \ 
    124118        math/gcc/umoddi3.o 
    125119endif 
    126 endif # debug 
     120ifeq ($(BUILD_TARGET_ARCH),amd64) 
     121OBJS += alloc/heapsimple.o 
     122endif 
    127123 
    128124ifneq ($(MAKECMDGOALS),clean) 
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r13306 r13314  
    944944} 
    945945 
    946  
    947 /** @todo move to IPRT! */ 
    948 RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 
    949 { 
    950     printk("!!Assertion Failed!!\n" 
    951              "Expression: %s\n" 
    952              "Location  : %s(%d) %s\n", 
    953              pszExpr, pszFile, uLine, pszFunction); 
    954 } 
    955  
    956  
    957 /** @todo move to IPRT! */ 
    958 RTDECL(void) AssertMsg2(const char *pszFormat, ...) 
    959 {   /* forwarder. */ 
    960     va_list ap; 
    961     char    msg[256]; 
    962  
    963     va_start(ap, pszFormat); 
    964     vsnprintf(msg, sizeof(msg) - 1, pszFormat, ap); 
    965     msg[sizeof(msg) - 1] = '\0'; 
    966     printk("%s", msg); 
    967     va_end(ap); 
    968 } 
    969  
    970  
    971 /* GCC C++ hack. (shouldn't be necessary with the right exception flags...) */ 
    972 unsigned __gxx_personality_v0 = 0xcccccccc; 
    973  
    974  
    975946module_init(VBoxDrvLinuxInit); 
    976947module_exit(VBoxDrvLinuxUnload); 
  • trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv

    r13306 r13314  
    9999    ${PATH_ROOT}/src/VBox/Runtime/r0drv/mpnotification-r0drv.c=>r0drv/mpnotification-r0drv.c \ 
    100100    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c=>r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \ 
     101    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c=>r0drv/linux/assert-r0drv-linux.c \ 
    101102    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c=>r0drv/linux/alloc-r0drv-linux.c \ 
    102103    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c=>r0drv/linux/initterm-r0drv-linux.c \ 
  • trunk/src/VBox/Runtime/Makefile.kmk

    r13306 r13314  
    980980        r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp \ 
    981981        r0drv/linux/alloc-r0drv-linux.c \ 
     982        r0drv/linux/assert-r0drv-linux.c \ 
    982983        r0drv/linux/initterm-r0drv-linux.c \ 
    983984        r0drv/linux/memobj-r0drv-linux.c \ 
  • trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp

    r13312 r13314  
    4949/** The last assert message, 2nd part. */ 
    5050RTDATADECL(char)                    g_szRTAssertMsg2[2048]; 
     51/** The last assert message, expression. */ 
     52RTDATADECL(const char * volatile)   g_pszRTAssertExpr; 
    5153/** The last assert message, file name. */ 
    52 RTDATADECL(const char *) volatile   g_pszRTAssertFile; 
     54RTDATADECL(const char * volatile)   g_pszRTAssertFile; 
    5355/** The last assert message, line number. */ 
    54 RTDATADECL(uint32_t) volatile       g_u32RTAssertLine; 
     56RTDATADECL(uint32_t volatile)       g_u32RTAssertLine; 
    5557/** The last assert message, function name. */ 
    56 RTDATADECL(const char *) volatile   g_pszRTAssertFunction; 
     58RTDATADECL(const char *  volatile)  g_pszRTAssertFunction; 
    5759 
    5860 
     
    7678                "Location  : %s(%d) %s\n", 
    7779                pszExpr, pszFile, uLine, pszFunction); 
     80    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertExpr, (void *)pszExpr); 
    7881    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFile, (void *)pszFile); 
    7982    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFunction, (void *)pszFunction); 
  • trunk/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c

    r13310 r13314  
    11/* $Id$ */ 
    22/** @file 
    3  * IPRT -  Assertion Workers, Ring-0 Drivers, Darwin
     3 * IPRT -  Assertion Workers, Ring-0 Drivers, Linux
    44 */ 
    55 
     
    3333*   Header Files                                                               * 
    3434*******************************************************************************/ 
    35 #include "the-darwin-kernel.h" 
     35#include "the-linux-kernel.h" 
    3636 
    3737#include <iprt/assert.h> 
     
    4949/** The last assert message, 2nd part. */ 
    5050RTDATADECL(char)                    g_szRTAssertMsg2[2048]; 
     51/** The last assert message, file name. */ 
     52RTDATADECL(const char *) volatile   g_pszRTAssertExpr; 
    5153/** The last assert message, file name. */ 
    5254RTDATADECL(const char *) volatile   g_pszRTAssertFile; 
     
    6668#endif 
    6769 
    68     printf("\r\n!!Assertion Failed!!\r\n" 
     70    printk("\r\n!!Assertion Failed!!\r\n" 
    6971           "Expression: %s\r\n" 
    7072           "Location  : %s(%d) %s\r\n", 
     
    7678                "Location  : %s(%d) %s\n", 
    7779                pszExpr, pszFile, uLine, pszFunction); 
    78     ASMAtomicUoWritePtr(&g_pszRTAssertFile, pszFile); 
     80    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertExpr, (void *)pszExpr); 
     81    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFile, (void *)pszFile); 
     82    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFunction, (void *)pszFunction); 
    7983    ASMAtomicUoWriteU32(&g_u32RTAssertLine, uLine); 
    80     ASMAtomicUoWritePtr(&g_pszRTAssertFunction, pszFunction); 
    8184} 
    8285 
     
    97100    szMsg[sizeof(szMsg) - 1] = '\0'; 
    98101    va_end(va); 
    99     printf("%s", szMsg); 
     102    printk("%s", szMsg); 
    100103 
    101104    va_start(va, pszFormat); 
  • trunk/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c

    r13313 r13314  
    4949/** The last assert message, 2nd part. */ 
    5050RTDATADECL(char)                    g_szRTAssertMsg2[2048]; 
     51/** The last assert message, expression. */ 
     52RTDATADECL(const char * volatile)   g_pszRTAssertExpr; 
    5153/** The last assert message, file name. */ 
    52 RTDATADECL(const char *) volatile   g_pszRTAssertFile; 
     54RTDATADECL(const char * volatile)   g_pszRTAssertFile; 
    5355/** The last assert message, line number. */ 
    54 RTDATADECL(uint32_t) volatile       g_u32RTAssertLine; 
     56RTDATADECL(uint32_t volatile)       g_u32RTAssertLine; 
    5557/** The last assert message, function name. */ 
    56 RTDATADECL(const char *) volatile   g_pszRTAssertFunction; 
     58RTDATADECL(const char * volatile)   g_pszRTAssertFunction; 
    5759 
    5860 
     
    7779                "Location  : %s(%d) %s\n", 
    7880                pszExpr, pszFile, uLine, pszFunction); 
     81    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertExpr, (void *)pszExpr); 
    7982    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFile, (void *)pszFile); 
    8083    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFunction, (void *)pszFunction); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy