You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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
…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: #39234Closes: #28218
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, asbegin_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.The text was updated successfully, but these errors were encountered: