X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4db307e110e2559ac88fcad53bb2b7688240e29c..07aaf32633ecf18ec3edfbb41793a112914792d0:/src/msw/stackwalk.cpp?ds=sidebyside diff --git a/src/msw/stackwalk.cpp b/src/msw/stackwalk.cpp index c620eae669..9ff630ac76 100644 --- a/src/msw/stackwalk.cpp +++ b/src/msw/stackwalk.cpp @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/stackwalk.cpp +// Name: src/msw/stackwalk.cpp // Purpose: wxStackWalker implementation for Win32 // Author: Vadim Zeitlin -// Modified by: +// Modified by: Artur Bac 2010-10-01 AMD64 Port // Created: 2005-01-08 // RCS-ID: $Id$ // Copyright: (c) 2003-2005 Vadim Zeitlin @@ -68,7 +68,7 @@ void wxStackFrame::OnGetName() pSymbol ) ) { - wxDbgHelpDLL::LogError(_T("SymFromAddr")); + wxDbgHelpDLL::LogError(wxT("SymFromAddr")); return; } @@ -96,7 +96,7 @@ void wxStackFrame::OnGetLocation() { // it is normal that we don't have source info for some symbols, // notably all the ones from the system DLLs... - //wxDbgHelpDLL::LogError(_T("SymGetLineFromAddr")); + //wxDbgHelpDLL::LogError(wxT("SymGetLineFromAddr")); return; } @@ -161,7 +161,7 @@ void wxStackFrame::OnParam(PSYMBOL_INFO pSymInfo) BOOL CALLBACK EnumSymbolsProc(PSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data) { - wxStackFrame *frame = wx_static_cast(wxStackFrame *, data); + wxStackFrame *frame = static_cast(data); // we're only interested in parameters if ( pSymInfo->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER ) @@ -190,7 +190,7 @@ void wxStackFrame::OnGetParam() // address, this is not a real error if ( ::GetLastError() != ERROR_INVALID_ADDRESS ) { - wxDbgHelpDLL::LogError(_T("SymSetContext")); + wxDbgHelpDLL::LogError(wxT("SymSetContext")); } return; @@ -205,7 +205,7 @@ void wxStackFrame::OnGetParam() this // data to pass to it ) ) { - wxDbgHelpDLL::LogError(_T("SymEnumSymbols")); + wxDbgHelpDLL::LogError(wxT("SymEnumSymbols")); } } @@ -221,7 +221,7 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) // don't log a user-visible error message here because the stack trace // is only needed for debugging/diagnostics anyhow and we shouldn't // confuse the user by complaining that we couldn't generate it - wxLogDebug(_T("Failed to get stack backtrace: %s"), + wxLogDebug(wxT("Failed to get stack backtrace: %s"), wxDbgHelpDLL::GetErrorMessage().c_str()); return; } @@ -240,7 +240,7 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) TRUE // load symbols for all loaded modules ) ) { - wxDbgHelpDLL::LogError(_T("SymInitialize")); + wxDbgHelpDLL::LogError(wxT("SymInitialize")); return; } @@ -253,7 +253,16 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) STACKFRAME sf; wxZeroMemory(sf); -#ifdef _M_IX86 +#if defined(_M_AMD64) + sf.AddrPC.Offset = ctx.Rip; + sf.AddrPC.Mode = AddrModeFlat; + sf.AddrStack.Offset = ctx.Rsp; + sf.AddrStack.Mode = AddrModeFlat; + sf.AddrFrame.Offset = ctx.Rbp; + sf.AddrFrame.Mode = AddrModeFlat; + + dwMachineType = IMAGE_FILE_MACHINE_AMD64; +#elif defined(_M_IX86) sf.AddrPC.Offset = ctx.Eip; sf.AddrPC.Mode = AddrModeFlat; sf.AddrStack.Offset = ctx.Esp; @@ -284,7 +293,7 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) ) ) { if ( ::GetLastError() ) - wxDbgHelpDLL::LogError(_T("StackWalk")); + wxDbgHelpDLL::LogError(wxT("StackWalk")); break; } @@ -300,14 +309,10 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) } } - // this results in crashes inside ntdll.dll when called from - // exception handler ... -#if 0 if ( !wxDbgHelpDLL::SymCleanup(hProcess) ) { - wxDbgHelpDLL::LogError(_T("SymCleanup")); + wxDbgHelpDLL::LogError(wxT("SymCleanup")); } -#endif } void wxStackWalker::WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip, size_t maxDepth) @@ -322,7 +327,7 @@ void wxStackWalker::WalkFromException(size_t maxDepth) extern EXCEPTION_POINTERS *wxGlobalSEInformation; wxCHECK_RET( wxGlobalSEInformation, - _T("wxStackWalker::WalkFromException() can only be called from wxApp::OnFatalException()") ); + wxT("wxStackWalker::WalkFromException() can only be called from wxApp::OnFatalException()") ); // don't skip any frames, the first one is where we crashed WalkFrom(wxGlobalSEInformation, 0, maxDepth);