diff --git a/backward.hpp b/backward.hpp index 670aa45..53259af 100644 --- a/backward.hpp +++ b/backward.hpp @@ -1136,6 +1136,15 @@ class StackTraceImpl : public StackTraceImplHolder { void *error_addr = nullptr) { set_context(static_cast(context)); set_error_addr(error_addr); + + if (!context) { + _stacktrace.resize(depth); + const WORD capturedFrames = RtlCaptureStackBackTrace( + 0, static_cast(depth), _stacktrace.data(), NULL); + _stacktrace.resize(capturedFrames); + return capturedFrames; + } + CONTEXT localCtx; // used when no context is provided if (depth == 0) {