diff --git a/src/dbghelp.rs b/src/dbghelp.rs index 30033fc8..4367ca4d 100644 --- a/src/dbghelp.rs +++ b/src/dbghelp.rs @@ -35,7 +35,7 @@ mod dbghelp { use crate::windows::*; pub use winapi::um::dbghelp::{ StackWalk64, StackWalkEx, SymFunctionTableAccess64, SymGetModuleBase64, SymGetOptions, - SymInitializeW, SymSetOptions, + SymInitializeW, SymSetOptions, SymFromAddrW, SymGetLineFromAddrW64 }; extern "system" { @@ -233,6 +233,18 @@ dbghelp! { CurContext: LPDWORD, CurFrameIndex: LPDWORD ) -> BOOL; + fn SymFromAddrW( + hProcess: HANDLE, + Address: DWORD64, + Displacement: PDWORD64, + Symbol: PSYMBOL_INFOW + ) -> BOOL; + fn SymGetLineFromAddrW64( + hProcess: HANDLE, + dwAddr: DWORD64, + pdwDisplacement: PDWORD, + Line: PIMAGEHLP_LINEW64 + ) -> BOOL; } } diff --git a/src/symbolize/dbghelp.rs b/src/symbolize/dbghelp.rs index 0ca58c83..94cccbca 100644 --- a/src/symbolize/dbghelp.rs +++ b/src/symbolize/dbghelp.rs @@ -98,6 +98,8 @@ unsafe fn resolve_with_inline( let (inlined_frame_count, inline_context) = if let Some(ic) = inline_context { (0, ic) + } else if (*dbghelp.dbghelp()).SymAddrIncludeInlineTrace().is_none() { + (0, 0) } else { let mut inlined_frame_count = dbghelp.SymAddrIncludeInlineTrace()(current_process, addr); @@ -129,17 +131,25 @@ unsafe fn resolve_with_inline( for inline_context in inline_context..last_inline_context { do_resolve( |info| { - dbghelp.SymFromInlineContextW()(current_process, addr, inline_context, &mut 0, info) + if (*dbghelp.dbghelp()).SymFromInlineContextW().is_some() { + dbghelp.SymFromInlineContextW()(current_process, addr, inline_context, &mut 0, info) + } else { + dbghelp.SymFromAddrW()(current_process, addr, &mut 0, info) + } }, |line| { - dbghelp.SymGetLineFromInlineContextW()( - current_process, - addr, - inline_context, - 0, - &mut 0, - line, - ) + if (*dbghelp.dbghelp()).SymGetLineFromInlineContextW().is_some() { + dbghelp.SymGetLineFromInlineContextW()( + current_process, + addr, + inline_context, + 0, + &mut 0, + line, + ) + } else { + dbghelp.SymGetLineFromAddrW64()(current_process, addr, &mut 0, line) + } }, cb, );