Changeset 73762 in vbox for trunk/src/VBox/Runtime/common/misc
- Timestamp:
- Aug 19, 2018 1:43:17 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124445
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/assert.cpp
r69111 r73762 33 33 34 34 #include <iprt/asm.h> 35 #ifdef IPRT_WITH_ASSERT_STACK 36 # ifndef IN_RING3 37 # error "IPRT_WITH_ASSERT_STACK is only for ring-3 at present." 38 # endif 39 # include <iprt/dbg.h> 40 #endif 35 41 #include <iprt/err.h> 36 42 #include <iprt/log.h> … … 46 52 * Global Variables * 47 53 *********************************************************************************************************************************/ 48 /** The last assert message, 1st part. */54 /** The last assertion message, 1st part. */ 49 55 RTDATADECL(char) g_szRTAssertMsg1[1024]; 50 56 RT_EXPORT_SYMBOL(g_szRTAssertMsg1); 51 /** The last assert message, 2nd part. */57 /** The last assertion message, 2nd part. */ 52 58 RTDATADECL(char) g_szRTAssertMsg2[4096]; 53 59 RT_EXPORT_SYMBOL(g_szRTAssertMsg2); 60 #ifdef IPRT_WITH_ASSERT_STACK 61 /** The last assertion message, stack part. */ 62 RTDATADECL(char) g_szRTAssertStack[4096]; 63 RT_EXPORT_SYMBOL(g_szRTAssertStack); 64 #endif 54 65 /** The length of the g_szRTAssertMsg2 content. 55 66 * @remarks Race. */ 56 67 static uint32_t volatile g_cchRTAssertMsg2; 57 /** The last assert message, expression. */68 /** The last assertion message, expression. */ 58 69 RTDATADECL(const char * volatile) g_pszRTAssertExpr; 59 70 RT_EXPORT_SYMBOL(g_pszRTAssertExpr); 60 /** The last assert message, function name. */71 /** The last assertion message, function name. */ 61 72 RTDATADECL(const char * volatile) g_pszRTAssertFunction; 62 73 RT_EXPORT_SYMBOL(g_pszRTAssertFunction); 63 /** The last assert message, file name. */74 /** The last assertion message, file name. */ 64 75 RTDATADECL(const char * volatile) g_pszRTAssertFile; 65 76 RT_EXPORT_SYMBOL(g_pszRTAssertFile); 66 /** The last assert message, line number. */77 /** The last assertion message, line number. */ 67 78 RTDATADECL(uint32_t volatile) g_u32RTAssertLine; 68 79 RT_EXPORT_SYMBOL(g_u32RTAssertLine); … … 126 137 RTErrVarsSave(&SavedErrVars); 127 138 139 #ifdef IPRT_WITH_ASSERT_STACK 140 /* The stack dump. */ 141 char szStack[sizeof(g_szRTAssertStack)]; 142 size_t cchStack = RTDbgStackDumpSelf(szStack, sizeof(szStack), 0); 143 memcpy(g_szRTAssertStack, szStack, cchStack + 1); 144 #endif 145 128 146 #ifdef IN_RING0 129 147 # ifdef IN_GUEST_R0 … … 153 171 "Location : %s(%d) %s\n", 154 172 pszExpr, pszFile, uLine, pszFunction); 173 # ifdef IPRT_WITH_ASSERT_STACK 174 RTLogRelPrintf("Stack :\n%s\n", szStack); 175 # endif 155 176 # ifndef IN_RC /* flushing is done automatically in RC */ 156 177 RTLogFlush(pLog); … … 169 190 "Location : %s(%d) %s\n", 170 191 pszExpr, pszFile, uLine, pszFunction); 192 # ifdef IPRT_WITH_ASSERT_STACK 193 RTLogPrintf("Stack :\n%s\n", szStack); 194 # endif 171 195 # ifndef IN_RC /* flushing is done automatically in RC */ 172 196 RTLogFlush(pLog); … … 185 209 uLine, 186 210 VALID_PTR(pszFunction) ? pszFunction : ""); 211 # ifdef IPRT_WITH_ASSERT_STACK 212 fprintf(stderr, "Stack :\n%s\n", szStack); 213 # endif 187 214 fflush(stderr); 188 215 # endif
Note:
See TracChangeset
for help on using the changeset viewer.