diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index 0fd5724f9ee..f8398c2b9db 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -224,6 +224,13 @@ jobs: with: name: OrcaSlicer_Windows_V${{ env.ver }} path: ${{ github.workspace }}/build/OrcaSlicer*.exe + + - name: Upload artifacts Win PDB + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v3 + with: + name: OrcaSlicer_Windows_V${{ env.ver }}_pdb + path: ${{ github.workspace }}/build/src/Release/*.pdb # Ubuntu - name: Install dependencies diff --git a/src/BaseException.cpp b/src/BaseException.cpp index d51a7505778..2443ebe4bb1 100644 --- a/src/BaseException.cpp +++ b/src/BaseException.cpp @@ -91,8 +91,26 @@ void CBaseException::ShowLoadModules() void CBaseException::ShowCallstack(HANDLE hThread, const CONTEXT* context) { - OutputString(_T("Show CallStack:\r\n")); - LPSTACKINFO phead = StackWalker(hThread, context); + OutputString(_T("Show CallStack:\n")); + LPSTACKINFO phead = StackWalker(hThread, context); + + // Show RVA of each call stack, so we can locate the symbol using pdb file + // To show the symbol, load the in WinDBG with pdb file, then type the following commands: + // > lm which gives you the start address of each module, as well as module names + // > !dh list all module headers. Find the of the section given by + // the
output in the crash log + // > ln +
+ reveals the debug symbol + OutputString(_T("\nLogical Address:\n")); + TCHAR szFaultingModule[MAX_PATH]; + DWORD section, offset; + for (LPSTACKINFO ps = phead; ps != nullptr; ps = ps->pNext) { + if (GetLogicalAddress((PVOID) ps->szFncAddr, szFaultingModule, sizeof(szFaultingModule), section, offset)) { + OutputString(_T("0x%X 0x%X:0x%X %s\n"), ps->szFncAddr, section, offset, szFaultingModule); + } else { + OutputString(_T("0x%X Unknown\n"), ps->szFncAddr); + } + } + FreeStackInformations(phead); } diff --git a/src/StackWalker.cpp b/src/StackWalker.cpp index 2d20cbd0dac..818ac3405e9 100644 --- a/src/StackWalker.cpp +++ b/src/StackWalker.cpp @@ -491,7 +491,7 @@ LPSTACKINFO CStackWalker::StackWalker(HANDLE hThread, const CONTEXT* context) }else { //调用错误一般是487(地址无效或者没有访问的权限、在符号表中未找到指定地址的相关信息) - this->OutputString(_T("Call SymGetSymFromAddr64 ,Address %08x Error:%08x\r\n"), sf.AddrPC.Offset, GetLastError()); + //this->OutputString(_T("Call SymGetSymFromAddr64 ,Address %08x Error:%08x\n"), sf.AddrPC.Offset, GetLastError()); StringCchCopy(pCallStack->undFullName, STACKWALK_MAX_NAMELEN, textconv_helper::A2T_("Unknown")); } @@ -502,14 +502,14 @@ 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()); + //this->OutputString(_T("Call SymGetLineFromAddr64 ,Address %08x Error:%08x\n"), sf.AddrPC.Offset, GetLastError()); StringCchCopy(pCallStack->szFileName, MAX_PATH, textconv_helper::A2T_("Unknown file")); pCallStack->uFileNum = -1; } //这里为了将获取函数信息失败的情况与正常的情况一起输出,防止用户在查看时出现误解 - this->OutputString(_T("%08llx:%s [%s][%ld]\r\n"), pCallStack->szFncAddr, pCallStack->undFullName, pCallStack->szFileName, pCallStack->uFileNum); + this->OutputString(_T("%08llx:%s [%s][%ld]\n"), pCallStack->szFncAddr, pCallStack->undFullName, pCallStack->szFileName, pCallStack->uFileNum); if (NULL == pHead) { pHead = pCallStack;