Skip to content

Commit 87be38e

Browse files
authored
Fix backtraces on Wine (#460)
Wine's implementation of `StackWalkEx` expects the `StackFrameSize` field of `STACKFRAME_EX` to be properly initialized to the size of `STACKFRAME_EX`.
1 parent f2705f8 commit 87be38e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backtrace/dbghelp.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
137137
// since it's in theory supported on more systems.
138138
match (*dbghelp.dbghelp()).StackWalkEx() {
139139
Some(StackWalkEx) => {
140+
let mut inner: STACKFRAME_EX = mem::zeroed();
141+
inner.StackFrameSize = mem::size_of::<STACKFRAME_EX>() as DWORD;
140142
let mut frame = super::Frame {
141143
inner: Frame {
142-
stack_frame: StackFrame::New(mem::zeroed()),
144+
stack_frame: StackFrame::New(inner),
143145
base_address: 0 as _,
144146
},
145147
};

0 commit comments

Comments
 (0)