From 238eda525de70b57bade634447c967f4f92bc96d Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Mon, 23 May 2022 00:06:45 -0400 Subject: [PATCH 2/3] Remove _M_IX86 checks --- Main/StackWalker/StackWalker.h | 52 ---------------------------------- 1 file changed, 52 deletions(-) diff --git a/Main/StackWalker/StackWalker.h b/Main/StackWalker/StackWalker.h index 03efcec..89be951 100644 --- a/Main/StackWalker/StackWalker.h +++ b/Main/StackWalker/StackWalker.h @@ -179,57 +179,6 @@ protected: friend StackWalkerInternal; }; // class StackWalker -// The "ugly" assembler-implementation is needed for systems before XP -// If you have a new PSDK and you only compile for XP and later, then you can use -// the "RtlCaptureContext" -// Currently there is no define which determines the PSDK-Version... -// So we just use the compiler-version (and assumes that the PSDK is -// the one which was installed by the VS-IDE) - -// INFO: If you want, you can use the RtlCaptureContext if you only target XP and later... -// But I currently use it in x64/IA64 environments... -//#if defined(_M_IX86) && (_WIN32_WINNT <= 0x0500) && (_MSC_VER < 1400) - -#if defined(_M_IX86) -#ifdef CURRENT_THREAD_VIA_EXCEPTION -// TODO: The following is not a "good" implementation, -// because the callstack is only valid in the "__except" block... -#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \ - do \ - { \ - memset(&c, 0, sizeof(CONTEXT)); \ - EXCEPTION_POINTERS* pExp = NULL; \ - __try \ - { \ - throw 0; \ - } \ - __except (((pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER \ - : EXCEPTION_EXECUTE_HANDLER)) \ - { \ - } \ - if (pExp != NULL) \ - memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \ - c.ContextFlags = contextFlags; \ - } while (0); -#else -// clang-format off -// The following should be enough for walking the callstack... -#define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \ - do \ - { \ - memset(&c, 0, sizeof(CONTEXT)); \ - c.ContextFlags = contextFlags; \ - __asm call x \ - __asm x: pop eax \ - __asm mov c.Eip, eax \ - __asm mov c.Ebp, ebp \ - __asm mov c.Esp, esp \ - } while (0) -// clang-format on -#endif - -#else - // The following is defined for x86 (XP and higher), x64 and IA64: #define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \ do \ @@ -238,7 +187,6 @@ protected: c.ContextFlags = contextFlags; \ RtlCaptureContext(&c); \ } while (0); -#endif #endif //defined(_MSC_VER)