Skip to content

Backtraces never worked on i686-pc-windows-gnu #28218

Closed
@Diggsey

Description

@Diggsey

Backtraces on windows are generated using the StackWalk64 function. This will generate incorrect backtraces if any of the frame pointers are omitted due to FPO. This would normally be fine, as debug builds are compiled without FPO enabled.

However, even in debug builds, the code will be linked to an optimised build of libstd, so if any frames from libstd are on the top of the stack when the backtrace is generated (which will always be the case for obvious reasons) there's the potential for one or more of those frames to have been optimised out, breaking the backtrace.

On i686-pc-windows-gnu, this turns out to always be the case, as begin_unwind_inner triggers FPO.

On x86_64-pc-windows-gnu, it currently works, but I'm unsure if that's just luck, or whether FPO is not used for that target.

This was not caught by tests because run-pass/backtrace.rs has been (accidentally?) disabled on all windows targets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions