diff --git a/src/libs/utils/qtcassert.cpp b/src/libs/utils/qtcassert.cpp index 65e39891f61..d8f07b736bd 100644 --- a/src/libs/utils/qtcassert.cpp +++ b/src/libs/utils/qtcassert.cpp @@ -64,7 +64,8 @@ void dumpBacktrace(int maxdepth) frame.AddrStack.Offset = ctx.Sp; frame.AddrFrame.Offset = ctx.Fp; #endif - int depth = 0; + // ignore the first two frames those contain only writeAssertLocation and dumpBacktrace + int depth = -3; static bool symbolsInitialized = false; if (!symbolsInitialized) { @@ -82,6 +83,8 @@ void dumpBacktrace(int maxdepth) &SymFunctionTableAccess64, &SymGetModuleBase64, NULL)) { + if (++depth < 0) + continue; char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)]; PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer; pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); @@ -95,7 +98,7 @@ void dumpBacktrace(int maxdepth) IMAGEHLP_LINE64 lineInfo; SymSetOptions(SYMOPT_LOAD_LINES); - QString out = QString("%1: 0x%2 at %3") + QString out = QString(" %1: 0x%2 at %3") .arg(depth) .arg(QString::number(pSymbol->Address, 16)) .arg(QString::fromLatin1(&pSymbol->Name[0], pSymbol->NameLen)); @@ -105,7 +108,7 @@ void dumpBacktrace(int maxdepth) QString::number(lineInfo.LineNumber))); } qDebug().noquote() << out; - if (++depth == maxdepth) + if (depth == maxdepth) break; } mutex.unlock();