1414
1515use core:: ptr;
1616
17- use super :: DwarfReader ;
17+ use unwind as uw;
18+
19+ use super :: dwarf:: DwarfReader ;
1820
1921pub const DW_EH_PE_omit : u8 = 0xFF ;
2022pub const DW_EH_PE_absptr : u8 = 0x00 ;
@@ -37,11 +39,10 @@ pub const DW_EH_PE_aligned: u8 = 0x50;
3739pub const DW_EH_PE_indirect : u8 = 0x80 ;
3840
3941#[ derive( Copy , Clone ) ]
40- pub struct EHContext < ' a > {
41- pub ip : * const u8 , // Current instruction pointer
42- pub func_start : * const u8 , // Pointer to the current function
43- pub get_text_start : & ' a dyn Fn ( ) -> * const u8 , // Get pointer to the code section
44- pub get_data_start : & ' a dyn Fn ( ) -> * const u8 , // Get pointer to the data section
42+ pub struct EHContext {
43+ pub ( crate ) ip : * const u8 , // Current instruction pointer
44+ pub ( crate ) func_start : * const u8 , // Pointer to the current function
45+ pub ( crate ) raw_context : * mut uw:: _Unwind_Context ,
4546}
4647
4748/// Landing pad.
@@ -63,7 +64,7 @@ pub enum EHAction {
6364pub const USING_SJLJ_EXCEPTIONS : bool =
6465 cfg ! ( all( target_vendor = "apple" , not( target_os = "watchos" ) , target_arch = "arm" ) ) ;
6566
66- pub unsafe fn find_eh_action ( lsda : * const u8 , context : & EHContext < ' _ > ) -> Result < EHAction , ( ) > {
67+ pub unsafe fn find_eh_action ( lsda : * const u8 , context : & EHContext ) -> Result < EHAction , ( ) > {
6768 if lsda. is_null ( ) {
6869 return Ok ( EHAction :: None ) ;
6970 }
@@ -224,7 +225,7 @@ unsafe fn read_encoded_offset(reader: &mut DwarfReader, encoding: u8) -> Result<
224225/// [LSB-dwarf-ext]: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/dwarfext.html
225226unsafe fn read_encoded_pointer (
226227 reader : & mut DwarfReader ,
227- context : & EHContext < ' _ > ,
228+ context : & EHContext ,
228229 encoding : u8 ,
229230) -> Result < * const u8 , ( ) > {
230231 if encoding == DW_EH_PE_omit {
@@ -241,8 +242,8 @@ unsafe fn read_encoded_pointer(
241242 }
242243 context. func_start
243244 }
244- DW_EH_PE_textrel => ( * context. get_text_start ) ( ) ,
245- DW_EH_PE_datarel => ( * context. get_data_start ) ( ) ,
245+ DW_EH_PE_textrel => unsafe { uw :: _Unwind_GetTextRelBase ( context. raw_context ) } ,
246+ DW_EH_PE_datarel => unsafe { uw :: _Unwind_GetDataRelBase ( context. raw_context ) } ,
246247 // aligned means the value is aligned to the size of a pointer
247248 DW_EH_PE_aligned => {
248249 reader. ptr = reader. ptr . with_addr ( round_up ( reader. ptr . addr ( ) , size_of :: < * const u8 > ( ) ) ?) ;
0 commit comments