Changeset 25536 in vbox for trunk/src/VBox/Runtime/common/misc/assert.cpp
- Timestamp:
- Dec 21, 2009 11:06:08 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56209
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/assert.cpp
r25528 r25536 53 53 RT_EXPORT_SYMBOL(g_szRTAssertMsg1); 54 54 /** The last assert message, 2nd part. */ 55 RTDATADECL(char) g_szRTAssertMsg2[ 2048];55 RTDATADECL(char) g_szRTAssertMsg2[4096]; 56 56 RT_EXPORT_SYMBOL(g_szRTAssertMsg2); 57 /** The length of the g_szRTAssertMsg2 content. 58 * @remarks Race. */ 59 static uint32_t volatile g_cchRTAssertMsg2; 57 60 /** The last assert message, expression. */ 58 61 RTDATADECL(const char * volatile) g_pszRTAssertExpr; … … 188 191 189 192 190 RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va) 193 /** 194 * Worker for RTAssertMsg2V and RTAssertMsg2AddV 195 * 196 * @param fInitial True if it's RTAssertMsg2V, otherwise false. 197 * @param pszFormat The message format string. 198 * @param va The format arguments. 199 */ 200 static void rtAssertMsg2Worker(bool fInitial, const char *pszFormat, va_list va) 191 201 { 192 202 va_list vaCopy; 203 size_t cch; 193 204 194 205 /* 195 206 * The global first. 196 207 */ 197 va_copy(vaCopy, va); 198 RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, vaCopy); 199 va_end(vaCopy); 208 if (fInitial) 209 { 210 va_copy(vaCopy, va); 211 cch = RTStrPrintfV(g_szRTAssertMsg2, sizeof(g_szRTAssertMsg2), pszFormat, vaCopy); 212 ASMAtomicWriteU32(&g_cchRTAssertMsg2, (uint32_t)cch); 213 va_end(vaCopy); 214 } 215 else 216 { 217 cch = ASMAtomicReadU32(&g_cchRTAssertMsg2); 218 if (cch < sizeof(g_szRTAssertMsg2) - 4) 219 { 220 va_copy(vaCopy, va); 221 cch += RTStrPrintfV(&g_szRTAssertMsg2[cch], sizeof(g_szRTAssertMsg2) - cch, pszFormat, vaCopy); 222 ASMAtomicWriteU32(&g_cchRTAssertMsg2, (uint32_t)cch); 223 va_end(vaCopy); 224 } 225 } 200 226 201 227 /* … … 211 237 # endif 212 238 /** @todo fully integrate this with the logger... play safe a bit for now. */ 213 rtR0AssertNativeMsg2V( pszFormat, va);239 rtR0AssertNativeMsg2V(fInitial, pszFormat, va); 214 240 215 241 #else /* !IN_RING0 */ … … 255 281 256 282 } 283 284 285 RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va) 286 { 287 rtAssertMsg2Worker(true /*fInitial*/, pszFormat, va); 288 } 257 289 RT_EXPORT_SYMBOL(RTAssertMsg2V); 258 290 291 292 RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va) 293 { 294 rtAssertMsg2Worker(false /*fInitial*/, pszFormat, va); 295 } 296 RT_EXPORT_SYMBOL(RTAssertMsg2AddV); 297
Note:
See TracChangeset
for help on using the changeset viewer.