ifdef DumpStackTrace() for non-Unix.

This commit is contained in:
John Maguire 2012-01-17 20:45:33 -08:00
parent 5fe7d1ad20
commit ab58c72c66
1 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,7 @@ QString DemangleSymbol(const QString& symbol) {
}
void DumpStackTrace() {
#ifdef Q_OS_UNIX
void* callstack[128];
int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack));
char** symbols = backtrace_symbols(reinterpret_cast<void**>(&callstack), callstack_size);
@ -205,6 +206,9 @@ void DumpStackTrace() {
qLog(Debug) << DemangleSymbol(QString::fromAscii(symbols[i]));
}
free(symbols);
#else
qLog(Debug) << "FIXME: Implement printing stack traces on this platform";
#endif
}
} // namespace logging