@@ -49,6 +49,14 @@ impl Frame {
4949 Some ( self . base_address )
5050 }
5151
52+ #[ cfg( not( target_env = "gnu" ) ) ]
53+ pub fn inline_context ( & self ) -> Option < DWORD > {
54+ match self . stack_frame {
55+ StackFrame :: New ( ref new) => Some ( new. InlineFrameContext ) ,
56+ StackFrame :: Old ( _) => None ,
57+ }
58+ }
59+
5260 fn addr_pc ( & self ) -> & ADDRESS64 {
5361 match self . stack_frame {
5462 StackFrame :: New ( ref new) => & new. AddrPC ,
@@ -111,25 +119,8 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
111119 //
112120 // Note that `RtlLookupFunctionEntry` only works for in-process backtraces,
113121 // but that's all we support anyway, so it all lines up well.
114- cfg_if:: cfg_if! {
115- if #[ cfg( target_pointer_width = "64" ) ] {
116- use core:: ptr;
117-
118- unsafe extern "system" fn function_table_access( _process: HANDLE , addr: DWORD64 ) -> PVOID {
119- let mut base = 0 ;
120- RtlLookupFunctionEntry ( addr, & mut base, ptr:: null_mut( ) ) . cast( )
121- }
122-
123- unsafe extern "system" fn get_module_base( _process: HANDLE , addr: DWORD64 ) -> DWORD64 {
124- let mut base = 0 ;
125- RtlLookupFunctionEntry ( addr, & mut base, ptr:: null_mut( ) ) ;
126- base
127- }
128- } else {
129- let function_table_access = dbghelp. SymFunctionTableAccess64 ( ) ;
130- let get_module_base = dbghelp. SymGetModuleBase64 ( ) ;
131- }
132- }
122+ let function_table_access = dbghelp. SymFunctionTableAccess64 ( ) ;
123+ let get_module_base = dbghelp. SymGetModuleBase64 ( ) ;
133124
134125 let process_handle = GetCurrentProcess ( ) ;
135126
@@ -206,18 +197,6 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
206197 }
207198}
208199
209- #[ cfg( target_arch = "x86_64" ) ]
210- fn init_frame ( frame : & mut Frame , ctx : & CONTEXT ) -> WORD {
211- frame. addr_pc_mut ( ) . Offset = ctx. Rip as u64 ;
212- frame. addr_pc_mut ( ) . Mode = AddrModeFlat ;
213- frame. addr_stack_mut ( ) . Offset = ctx. Rsp as u64 ;
214- frame. addr_stack_mut ( ) . Mode = AddrModeFlat ;
215- frame. addr_frame_mut ( ) . Offset = ctx. Rbp as u64 ;
216- frame. addr_frame_mut ( ) . Mode = AddrModeFlat ;
217-
218- IMAGE_FILE_MACHINE_AMD64
219- }
220-
221200#[ cfg( target_arch = "x86" ) ]
222201fn init_frame ( frame : & mut Frame , ctx : & CONTEXT ) -> WORD {
223202 frame. addr_pc_mut ( ) . Offset = ctx. Eip as u64 ;
@@ -230,19 +209,6 @@ fn init_frame(frame: &mut Frame, ctx: &CONTEXT) -> WORD {
230209 IMAGE_FILE_MACHINE_I386
231210}
232211
233- #[ cfg( target_arch = "aarch64" ) ]
234- fn init_frame ( frame : & mut Frame , ctx : & CONTEXT ) -> WORD {
235- frame. addr_pc_mut ( ) . Offset = ctx. Pc as u64 ;
236- frame. addr_pc_mut ( ) . Mode = AddrModeFlat ;
237- frame. addr_stack_mut ( ) . Offset = ctx. Sp as u64 ;
238- frame. addr_stack_mut ( ) . Mode = AddrModeFlat ;
239- unsafe {
240- frame. addr_frame_mut ( ) . Offset = ctx. u . s ( ) . Fp as u64 ;
241- }
242- frame. addr_frame_mut ( ) . Mode = AddrModeFlat ;
243- IMAGE_FILE_MACHINE_ARM64
244- }
245-
246212#[ cfg( target_arch = "arm" ) ]
247213fn init_frame ( frame : & mut Frame , ctx : & CONTEXT ) -> WORD {
248214 frame. addr_pc_mut ( ) . Offset = ctx. Pc as u64 ;
0 commit comments