From a546cfde58849dd89eef960055fa1d41c858adcb Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Wed, 11 Oct 2023 11:38:24 +0800 Subject: [PATCH] Show as much information as possible in crash log --- src/StackWalker.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/StackWalker.cpp b/src/StackWalker.cpp index f625d23e732..20ab79fc274 100644 --- a/src/StackWalker.cpp +++ b/src/StackWalker.cpp @@ -492,7 +492,8 @@ LPSTACKINFO CStackWalker::StackWalker(HANDLE hThread, const CONTEXT* context) { //调用错误一般是487(地址无效或者没有访问的权限、在符号表中未找到指定地址的相关信息) this->OutputString(_T("Call SymGetSymFromAddr64 ,Address %08x Error:%08x\r\n"), sf.AddrPC.Offset, GetLastError()); - continue; + + StringCchCopy(pCallStack->undFullName, STACKWALK_MAX_NAMELEN, textconv_helper::A2T_("Unknown")); } if (SymGetLineFromAddr64(m_hProcess, sf.AddrPC.Offset, (DWORD*)&dwDisplayment, pLine)) @@ -501,8 +502,10 @@ LPSTACKINFO CStackWalker::StackWalker(HANDLE hThread, const CONTEXT* context) pCallStack->uFileNum = pLine->LineNumber; }else { - this->OutputString(_T("Call SymGetLineFromAddr64 ,Address %08x Error:%08x\r\n"), sf.AddrPC.Offset, GetLastError()); - continue; + this->OutputString(_T("Call SymGetLineFromAddr64 ,Address %08x Error:%08x\r\n"), sf.AddrPC.Offset, GetLastError()); + + StringCchCopy(pCallStack->szFileName, MAX_PATH, textconv_helper::A2T_("Unknown file")); + pCallStack->uFileNum = -1; } //这里为了将获取函数信息失败的情况与正常的情况一起输出,防止用户在查看时出现误解