1- #![ cfg_attr( feature = "nightly" , feature( global_asm) ) ]
1+ #![ no_std]
2+ #![ cfg_attr( feature = "nightly" , feature( global_asm, alloc) ) ]
3+
4+ #![ cfg( all( not( feature = "std" ) , not( feature = "nightly" ) ) ) ]
5+ compiler_error ! ( "One of std or nightly feature needs to be enabled" ) ;
26
37extern crate gimli;
48extern crate libc;
@@ -15,7 +19,18 @@ pub mod libunwind_shim;
1519pub mod glue;
1620use registers:: { Registers , DwarfRegister } ;
1721use find_cfi:: EhRef ;
18-
22+ //#[cfg(feature = "std")]
23+ //extern crate std;
24+ #[ cfg( not( feature = "std" ) ) ]
25+ use core as std;
26+
27+ //#[cfg(feature = "std")]
28+ //mod alloc {
29+ // pub use std::*;
30+ // pub use std::prelude::v1::*;
31+ //}
32+ #[ cfg( not( feature = "std" ) ) ]
33+ extern crate alloc;
1934
2035pub struct StackFrames < ' a > {
2136 unwinder : & ' a mut DwarfUnwinder ,
@@ -57,7 +72,7 @@ impl Default for DwarfUnwinder {
5772
5873 let eh_frame_hdr: & ' static [ u8 ] = std:: slice:: from_raw_parts ( er. cfi . start as * const u8 , er. cfi . len ( ) as usize ) ;
5974
60- let eh_frame_hdr = EhFrameHdr :: new ( eh_frame_hdr, NativeEndian ) . parse ( & bases, 8 ) . unwrap ( ) ;
75+ let eh_frame_hdr = EhFrameHdr :: new ( eh_frame_hdr, NativeEndian ) . parse ( & bases, std :: mem :: size_of :: < * mut ( ) > ( ) as u8 ) . unwrap ( ) ;
6176
6277 let cfi_addr = deref_ptr ( eh_frame_hdr. eh_frame_ptr ( ) ) ;
6378 let cfi_sz = 0x10000000 ; // FIXME HACK
@@ -95,7 +110,6 @@ impl Unwinder for DwarfUnwinder {
95110 }
96111}
97112
98-
99113struct UnwindInfo < R : Reader > {
100114 row : UnwindTableRow < R > ,
101115 personality : Option < Pointer > ,
@@ -129,7 +143,7 @@ impl ObjectRecord {
129143
130144
131145 if let Some ( fde) = target_fde {
132- trace ! ( "fde {:x} - {:x}" , fde. initial_address( ) , fde. len( ) ) ;
146+ trace ! ( "fde {:x} - {:x}, {:x} " , fde. initial_address( ) , fde. len( ) , address ) ;
133147 if !fde. contains ( address) {
134148 return Err ( gimli:: Error :: NoUnwindInfoForAddress ) ;
135149 }
0 commit comments