Changeset 72383 in vbox
- Timestamp:
- May 29, 2018 2:45:53 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp
r70948 r72383 70 70 bool fRecSummary; 71 71 /** Buffer for the summary. */ 72 char szSummary[4096 -2];72 char szSummary[4096 - 2]; 73 73 /** The current summary offset. */ 74 74 size_t offSummary; 75 /** Standard error buffer. */ 76 char achStdErrBuf[4096 - 8]; 77 /** Standard error buffer offset. */ 78 size_t offStdErrBuf; 75 79 } VMMR3FATALDUMPINFOHLP, *PVMMR3FATALDUMPINFOHLP; 76 80 /** Pointer to a VMMR3FATALDUMPINFOHLP structure. */ 77 81 typedef const VMMR3FATALDUMPINFOHLP *PCVMMR3FATALDUMPINFOHLP; 82 83 84 /** 85 * Flushes the content of achStdErrBuf, setting offStdErrBuf to zero. 86 * 87 * @param pHlp The instance to flush. 88 */ 89 static void vmmR3FatalDumpInfoHlp_FlushStdErr(PVMMR3FATALDUMPINFOHLP pHlp) 90 { 91 size_t cch = pHlp->offStdErrBuf; 92 if (cch) 93 { 94 RTStrmWrite(g_pStdErr, pHlp->achStdErrBuf, cch); 95 pHlp->offStdErrBuf = 0; 96 } 97 } 98 99 /** 100 * @callback_method_impl{FNRTSTROUTPUT, For buffering stderr output.} 101 */ 102 static DECLCALLBACK(size_t) vmmR3FatalDumpInfoHlp_BufferedStdErrOutput(void *pvArg, const char *pachChars, size_t cbChars) 103 { 104 PVMMR3FATALDUMPINFOHLP pHlp = (PVMMR3FATALDUMPINFOHLP)pvArg; 105 if (cbChars) 106 { 107 size_t offBuf = pHlp->offStdErrBuf; 108 if (cbChars < sizeof(pHlp->achStdErrBuf) - offBuf) 109 { /* likely */ } 110 else 111 { 112 vmmR3FatalDumpInfoHlp_FlushStdErr(pHlp); 113 if (cbChars < sizeof(pHlp->achStdErrBuf)) 114 offBuf = 0; 115 else 116 { 117 RTStrmWrite(g_pStdErr, pachChars, cbChars); 118 return cbChars; 119 } 120 } 121 memcpy(&pHlp->achStdErrBuf[offBuf], pachChars, cbChars); 122 pHlp->offStdErrBuf = offBuf + cbChars; 123 } 124 return cbChars; 125 } 78 126 79 127 … … 93 141 } 94 142 95 96 143 /** 97 144 * Print formatted string. … … 123 170 va_list args2; 124 171 va_copy(args2, args); 125 RTStrmPrintfV(g_pStdErr, pszFormat, args); 172 RTStrFormatV(vmmR3FatalDumpInfoHlp_BufferedStdErrOutput, pMyHlp, NULL, NULL, pszFormat, args2); 173 //RTStrmPrintfV(g_pStdErr, pszFormat, args2); 126 174 va_end(args2); 127 175 } … … 193 241 pHlp->fStdErr = false; /* takes too long to display here */ 194 242 #endif 243 pHlp->offStdErrBuf = 0; 195 244 196 245 /* … … 222 271 pHlp->pLogger->fDestFlags = pHlp->fLoggerDestFlags; 223 272 } 273 274 if (pHlp->fStdErr) 275 vmmR3FatalDumpInfoHlp_FlushStdErr(pHlp); 224 276 } 225 277
Note:
See TracChangeset
for help on using the changeset viewer.