Skip to content

WIP: Collect at most as many frames as requested.#67

Merged
apolukhin merged 5 commits intoboostorg:developfrom
JanEisenhauer:develop
Oct 30, 2018
Merged

WIP: Collect at most as many frames as requested.#67
apolukhin merged 5 commits intoboostorg:developfrom
JanEisenhauer:develop

Conversation

@JanEisenhauer
Copy link
Copy Markdown
Contributor

Regardless of any user provided maximum stack depth boost::stacktrace::basic_stacktrace<>::init will try to obtain 128 stack frames.

For older Microsoft platforms like Windows Server 2003 and Windows XP this is problematic as RtlCaptureStackBacktrace has a stricter limit on the stack depth.

{ // Fast path without additional allocations
native_frame_ptr_t buffer[buffer_size];
const std::size_t frames_count = boost::stacktrace::detail::this_thread_frames::collect(buffer, buffer_size, frames_to_skip + 1);
const std::size_t frames_count = boost::stacktrace::detail::this_thread_frames::collect(buffer, std::min(buffer_size, max_depth), frames_to_skip + 1);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enables users on older Windows platforms to use small enough maximum stack depth.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 90.044% when pulling 5e85e74 on JanEisenhauer:develop into 4123beb on boostorg:develop.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 90.044% when pulling 5e85e74 on JanEisenhauer:develop into 4123beb on boostorg:develop.

@coveralls
Copy link
Copy Markdown

coveralls commented Oct 29, 2018

Coverage Status

Coverage decreased (-0.04%) to 90.0% when pulling cbd625b on JanEisenhauer:develop into 4123beb on boostorg:develop.

@apolukhin apolukhin merged commit 3948626 into boostorg:develop Oct 30, 2018
@apolukhin
Copy link
Copy Markdown
Member

Awesome! Many thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants