Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using RtlCaptureStackBackTrace instead of StackWalk64 #334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,15 @@ class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
void *error_addr = nullptr) {
set_context(static_cast<CONTEXT*>(context));
set_error_addr(error_addr);

if (!context) {
_stacktrace.resize(depth);
const WORD capturedFrames = RtlCaptureStackBackTrace(
0, static_cast<DWORD>(depth), _stacktrace.data(), NULL);
_stacktrace.resize(capturedFrames);
return capturedFrames;
}

CONTEXT localCtx; // used when no context is provided

if (depth == 0) {
Expand Down