googletest icon indicating copy to clipboard operation
googletest copied to clipboard

[FR]: Print stack traces on SEH exceptions

Open yeputons opened this issue 1 year ago • 0 comments

Does the feature exist in the most recent commit?

No

Why do we need this feature?

If there is a crash/access violation or other SEH exception in a test, Google Test only prints the error code at the moment, but does not print any kind of stack trace. While it's ok when debugging as the debugger can catch SEH itself, sometimes one may want to run tests en masse (e.g. in CI) and still have stack traces.

As I understand, at least some flavor of stack traces is currently supported in EXPECT_* macros, but for SEH exceptions it's only error code: https://github.com/google/googletest/blob/af39146b45619b7b0d98d1c85138bdb571975598/googletest/src/gtest.cc#L2558-L2569 https://github.com/google/googletest/blob/af39146b45619b7b0d98d1c85138bdb571975598/googletest/src/gtest.cc#L2612-L2625

Describe the proposal.

Print stack trace of the SEH exception as well. One can obtain addresses as described at https://stackoverflow.com/questions/26790042/how-to-generate-stack-trace-from-seh-exception , and then use Abseil to symbolize. Actually, just printing current stack trace in the SEH filter function is already helpful: it produces correct stack trace for me in 64-bit.

Is the feature specific to an operating system, compiler, or build system version?

Windows-only. Visual Studio for sure, definitely not GCC, maybe clang or clang-cl.

yeputons avatar Jun 21 '23 22:06 yeputons