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

Feature request: Expose dbghelp's InlineFrameContext somehow #695

Open
ChrisDenton opened this issue Jan 22, 2025 · 0 comments
Open

Feature request: Expose dbghelp's InlineFrameContext somehow #695

ChrisDenton opened this issue Jan 22, 2025 · 0 comments

Comments

@ChrisDenton
Copy link
Member

For rust-lang/rust#135804 I want to make sure the backtrace is always making progress. On most platforms it's enough to check the stack pointer changes. However, on x86 msvc with debuginfo=line-tables-only we also need to check to see if InlineFrameContext changes. Internally we have Frame::inline_context for this. But it's msvc only and not public.

So my idea is to add a public API that looks roughly like this:

/// An opaque struct that can be compared for equality with other stack contexts from the same trace.
#[derive(Clone, Eq, PartialEq)]
struct StackContext { ... };

impl Frame {
    pub fn stack_context(&self) -> Option<StackContext>;
}

On most targets StackContext will simply be a wrapper around the stack pointer. But on i686 msvc it'll be the stack pointer plus InlineFrameContext. Users (in this case std) can call frame.stack_context() to determine if the backtrace is stuck by comparing it to the previous StackContext.

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

No branches or pull requests

1 participant