ekcoh / gtest-memleak-detector

Google Test extension providing memory leak detection and debugging using MSVC CRT debug.
MIT License
3 stars 0 forks source link

Inline assembly in StackWalker makes x86 builds fail #6

Open ekcoh opened 3 years ago

ekcoh commented 3 years ago

Inline assembly in StackWalker makes x86 builds fail. It would be good to investigate this problem further and if not possible to work around, report it to StackWalker author and disable stacktrace for x86 builds if there is no better solution. At least memory leaks could be reported with lower traceability which can anyways easily be determined by switching to x64 builds temporarily.

ekcoh commented 3 years ago

Quick investigation performed and it turns out that a temporary #undef _M_IX86 before including StackWalker header and restoring _M_IX86 symbol directly after that disables the inline assembly _asm that the compiler complains about. Even if the method is switched to RtlCaptureContext instead of assembly version this seems fine on Windows 10 and x64 processor architecture (Intel i7 Skylake). Since non-RtlCaptureContext solution seems more relevant for older Windows version (pre-XP) this could be a good enough work-around. Will report to StackWalker author to see if additional information can be obtained.

The work-around is now available on master. Test passing for x86-Debug, x86-Release, X64-Debug, x64-Release.

ekcoh commented 3 years ago

Will leave this issue open for now.