Skip to content

Commit 93346c4

Browse files
committed
Using RtlCaptureStackBackTrace instead of StackWalk64 bombela#334
1 parent 0bedba4 commit 93346c4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backward.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,15 @@ class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
11541154
void *error_addr = nullptr) {
11551155
set_context(static_cast<CONTEXT*>(context));
11561156
set_error_addr(error_addr);
1157+
1158+
if (!context) {
1159+
_stacktrace.resize(depth);
1160+
const WORD capturedFrames = RtlCaptureStackBackTrace(
1161+
0, static_cast<DWORD>(depth), _stacktrace.data(), NULL);
1162+
_stacktrace.resize(capturedFrames);
1163+
return capturedFrames;
1164+
}
1165+
11571166
CONTEXT localCtx; // used when no context is provided
11581167

11591168
if (depth == 0) {

0 commit comments

Comments
 (0)