/// Create a frame table by reading the data in the given section.
///
/// `convert_address` is a function to convert read addresses into the `Address`
/// type. For non-relocatable addresses, this function may simply return
/// `Address::Constant(address)`. For relocatable addresses, it is the caller's
/// responsibility to determine the symbol and addend corresponding to the address
/// and return `Address::Symbol { symbol, addend }`.
Create a frame table by reading the data in the given section.
`convert_address` is a function to convert read addresses into the `Address`
type. For non-relocatable addresses, this function may simply return
`Address::Constant(address)`. For relocatable addresses, it is the caller's
responsibility to determine the symbol and addend corresponding to the address
and return `Address::Symbol { symbol, addend }`.
Create a frame table by reading the data in the given section . ` convert_address ` is a function to convert read addresses into the ` Address ` type . For non - relocatable addresses this function may simply return ` Address :: Constant ( address ) ` . For relocatable addresses it is the caller ' s responsibility to determine the symbol and addend corresponding to the address and return ` Address :: Symbol { symbol addend } ` .
pub fn from<R, Section>(
            frame: &Section,
            convert_address: &dyn Fn(u64) -> Option<Address>,
        ) -> ConvertResult<FrameTable>
        where
            R: Reader<Offset = usize>,
            Section: read::UnwindSection<R>,
            Section::Offset: read::UnwindOffset<usize>,
        {
            let bases = read::BaseAddresses::default().set_eh_frame(0);
            let mut frame_table = FrameTable::default();
            let mut cie_ids = HashMap::new();
            let mut entries = frame.entries(&bases);
            while let Some(entry) = entries.next()? {
                let partial = match entry {
                    read::CieOrFde::Cie(_) => continue,
                    read::CieOrFde::Fde(partial) => partial,
                };
                // TODO: is it worth caching the parsed CIEs? It would be better if FDEs only
                // stored a reference.
                let from_fde = partial.parse(Section::cie_from_offset)?;
                let from_cie = from_fde.cie();
                let cie_id = match cie_ids.entry(from_cie.offset()) {
                    hash_map::Entry::Occupied(o) => *o.get(),
                    hash_map::Entry::Vacant(e) => {
                        let cie =
                            CommonInformationEntry::from(from_cie, frame, &bases, convert_address)?;
                        let cie_id = frame_table.add_cie(cie);
                        e.insert(cie_id);
                        cie_id
                    }
                };
                let fde = FrameDescriptionEntry::from(&from_fde, frame, &bases, convert_address)?;
                frame_table.add_fde(cie_id, fde);
            }
            Ok(frame_table)
        }
pub fn from < R , Section > ( frame : & Section , convert_address : & dyn Fn ( u64 ) -> Option < Address > , ) -> ConvertResult < FrameTable > where R : Reader < Offset = usize > , Section : read :: UnwindSection < R > , Section :: Offset : read :: UnwindOffset < usize > , { let bases = read :: BaseAddresses :: default ( ) . set_eh_frame ( 0 ) ; let mut frame_table = FrameTable :: default ( ) ; let mut cie_ids = HashMap :: new ( ) ; let mut entries = frame . entries ( & bases ) ; while let Some ( entry ) = entries . next ( ) ? { let partial = match entry { read :: CieOrFde :: Cie ( _ ) => continue , read :: CieOrFde :: Fde ( partial ) => partial , } ; // TODO: is it worth caching the parsed CIEs? It would be better if FDEs only // stored a reference. let from_fde = partial . parse ( Section :: cie_from_offset ) ? ; let from_cie = from_fde . cie ( ) ; let cie_id = match cie_ids . entry ( from_cie . offset ( ) ) { hash_map :: Entry :: Occupied ( o ) => * o . get ( ) , hash_map :: Entry :: Vacant ( e ) => { let cie = CommonInformationEntry :: from ( from_cie , frame , & bases , convert_address ) ? ; let cie_id = frame_table . add_cie ( cie ) ; e . insert ( cie_id ) ; cie_id } } ; let fde = FrameDescriptionEntry :: from ( & from_fde , frame , & bases , convert_address ) ? ; frame_table . add_fde ( cie_id , fde ) ; } Ok ( frame_table ) }
Create a frame table by reading the data in the given section.
Create a frame table by reading the data in the given section .
frame
&Section
convert_address
&dyn Fn(u64) -> Option<Address>