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

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

Closed
Diggsey opened this issue Sep 3, 2015 · 1 comment
Closed

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

Diggsey opened this issue Sep 3, 2015 · 1 comment
Labels
O-windows Operating system: Windows

Comments

@Diggsey
Copy link
Contributor

Diggsey commented Sep 3, 2015

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.

@retep998
Copy link
Member

retep998 commented Sep 4, 2015

It is due to the Windowx 64-bit calling convention being designed in such a way that FPO can always be done and stack walking always work, unlike 32-bit.

@steveklabnik steveklabnik added the O-windows Operating system: Windows label Sep 4, 2015
segevfiner added a commit to segevfiner/rust that referenced this issue Jan 29, 2017
This might have performance implications. But do note that MSVC
disables FPO by default nowadays and it's use is limited in exception
heavy languages like C++.

Closes: rust-lang#28218
bors added a commit that referenced this issue Jan 31, 2017
…nu, r=alexcrichton

Fix backtraces on i686-pc-windows-gnu by disabling FPO

This might have performance implications. But do note that MSVC
disables FPO by default nowadays and it's use is limited in exception
heavy languages like C++.

See discussion in: #39234
Closes: #28218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

3 participants