rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
524 stars 240 forks source link

Panic on windows7 when resolving an inline #577

Closed roblabla closed 9 months ago

roblabla commented 9 months ago

Since https://github.com/rust-lang/backtrace-rs/pull/569 was merged, Backtrace::resolve panics on Windows 7 due to unwrapping an Option set to None. After some further instrumentation, I was able to find out the source of the problem: Failed to find SymAddrIncludeInlineTrace in dbghelp. This makes the capture::tests::test_frame_conversion unit test fail on Windows 7.

This is because Windows7 ships dbghelp.dll version 6.1, but SymAddrIncludeInlineTrace was added in dbghelp.dll version 6.2.

This affects the Rust stdlib Backtrace as well, see https://github.com/rust-lang/rust/issues/117941

ChrisDenton commented 9 months ago

Ah, sorry about that. dbghelp.dll version 6.2 does apparently support Windows 7 but isn't distributed with it.

Easiest fix would be to use something like (*dbghelp.dbghelp()).SymAddrIncludeInlineTrace().is_none() to switch back to the old way if the symbol isn't found.