WindowsFaultHandler: print the backtrace to stderr, not stdout
Otherwise the contents that vary per architecture and build will make it impossible to self-check (tst_selftests) Change-Id: Ibcde9b9795ad42ac9978fffd16f2cbc352c3503c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
764d82ceb5
commit
37aa9a9cef
@ -1878,36 +1878,35 @@ private:
|
|||||||
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
|
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
|
||||||
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
|
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
|
||||||
const void *exceptionAddress = exInfo->ExceptionRecord->ExceptionAddress;
|
const void *exceptionAddress = exInfo->ExceptionRecord->ExceptionAddress;
|
||||||
printf("A crash occurred in %s.\n"
|
fprintf(stderr, "A crash occurred in %s.\n"
|
||||||
"Function time: %dms Total time: %dms\n\n"
|
"Function time: %dms Total time: %dms\n\n"
|
||||||
"Exception address: 0x%p\n"
|
"Exception address: 0x%p\n"
|
||||||
"Exception code : 0x%lx\n",
|
"Exception code : 0x%lx\n",
|
||||||
appName, msecsFunctionTime, msecsTotalTime,
|
appName, msecsFunctionTime, msecsTotalTime,
|
||||||
exceptionAddress, exInfo->ExceptionRecord->ExceptionCode);
|
exceptionAddress, exInfo->ExceptionRecord->ExceptionCode);
|
||||||
|
|
||||||
DebugSymbolResolver resolver(GetCurrentProcess());
|
DebugSymbolResolver resolver(GetCurrentProcess());
|
||||||
if (resolver.isValid()) {
|
if (resolver.isValid()) {
|
||||||
DebugSymbolResolver::Symbol exceptionSymbol = resolver.resolveSymbol(DWORD64(exceptionAddress));
|
DebugSymbolResolver::Symbol exceptionSymbol = resolver.resolveSymbol(DWORD64(exceptionAddress));
|
||||||
if (exceptionSymbol.name) {
|
if (exceptionSymbol.name) {
|
||||||
printf("Nearby symbol : %s\n", exceptionSymbol.name);
|
fprintf(stderr, "Nearby symbol : %s\n", exceptionSymbol.name);
|
||||||
delete [] exceptionSymbol.name;
|
delete [] exceptionSymbol.name;
|
||||||
}
|
}
|
||||||
void *stack[maxStackFrames];
|
void *stack[maxStackFrames];
|
||||||
fputs("\nStack:\n", stdout);
|
fputs("\nStack:\n", stderr);
|
||||||
const unsigned frameCount = CaptureStackBackTrace(0, DWORD(maxStackFrames), stack, NULL);
|
const unsigned frameCount = CaptureStackBackTrace(0, DWORD(maxStackFrames), stack, NULL);
|
||||||
for (unsigned f = 0; f < frameCount; ++f) {
|
for (unsigned f = 0; f < frameCount; ++f) {
|
||||||
DebugSymbolResolver::Symbol symbol = resolver.resolveSymbol(DWORD64(stack[f]));
|
DebugSymbolResolver::Symbol symbol = resolver.resolveSymbol(DWORD64(stack[f]));
|
||||||
if (symbol.name) {
|
if (symbol.name) {
|
||||||
printf("#%3u: %s() - 0x%p\n", f + 1, symbol.name, (const void *)symbol.address);
|
fprintf(stderr, "#%3u: %s() - 0x%p\n", f + 1, symbol.name, (const void *)symbol.address);
|
||||||
delete [] symbol.name;
|
delete [] symbol.name;
|
||||||
} else {
|
} else {
|
||||||
printf("#%3u: Unable to obtain symbol\n", f + 1);
|
fprintf(stderr, "#%3u: Unable to obtain symbol\n", f + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fputc('\n', stdout);
|
fputc('\n', stderr);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user