Skip to content

Commit

Permalink
Fix backtraces on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Dec 31, 2018
1 parent 6efaef6 commit f4826ab
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/libstd/sys/windows/backtrace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn set_frames<W: StackWalker>(StackWalk: W, frames: &mut [Frame]) -> io::Result<
frames[i] = Frame {
symbol_addr: addr,
exact_position: addr,
inline_context: 0,
inline_context: frame.get_inline_context(),
};

i += 1
Expand Down Expand Up @@ -209,6 +209,7 @@ trait StackFrame {
fn new() -> Self;
fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD;
fn get_addr(&self) -> *const u8;
fn get_inline_context(&self) -> u32;
}

impl StackFrame for c::STACKFRAME_EX {
Expand Down Expand Up @@ -263,6 +264,10 @@ impl StackFrame for c::STACKFRAME_EX {
fn get_addr(&self) -> *const u8 {
(self.AddrPC.Offset - 1) as *const u8
}

fn get_inline_context(&self) -> u32 {
self.InlineFrameContext
}
}

impl StackFrame for c::STACKFRAME64 {
Expand Down Expand Up @@ -317,6 +322,10 @@ impl StackFrame for c::STACKFRAME64 {
fn get_addr(&self) -> *const u8 {
(self.AddrPC.Offset - 1) as *const u8
}

fn get_inline_context(&self) -> u32 {
0
}
}

enum StackWalkVariant {
Expand Down

0 comments on commit f4826ab

Please sign in to comment.