pub fn new(options: &'i DebugInfoBuilder, object: &'i object::File<'i>) -> Result<Self> {
        // most of the code in this function is based on the simple.rs example in the gimli crate
        let endian = if object.is_little_endian() {
            gimli::RunTimeEndian::Little
        } else {
            gimli::RunTimeEndian::Big
        };

        let load_section = |id: gimli::SectionId| -> result::Result<
            gimli::EndianSlice<'i, gimli::RunTimeEndian>,
            gimli::Error,
        > {
            let empty = Ok(gimli::EndianSlice::new(&[], endian));
            match object.section_by_name(id.name()) {
                Some(ref section) => {
                    if let Ok(data) = section.compressed_data() {
                        if data.format == object::CompressionFormat::None {
                            return Ok(gimli::EndianSlice::new(&data.data, endian));
                        }
                    }
                    empty
                }
                None => empty,
            }
        };
        // Load a supplementary section. We don't have a supplementary object file,
        // so always return an empty slice.
        let load_section_sup = |_| Ok(gimli::EndianSlice::new(&[], endian));

        // Load all of the sections.
        let dwarf = gimli::Dwarf::load(&load_section, &load_section_sup);
        let dwarf = dwarf.map_err(|e| {
            Error(ErrorImpl {
                code: ErrorCode::Gimli(e),
            })
        })?;

        Ok(DebugInfoParser {
            object,
            dwarf,
            options,
        })
    }
/// parse the data in an existing object
parse the data in an existing object
parse the data in an existing object
pub fn new(options: &'i DebugInfoBuilder, object: &'i object::File<'i>) -> Result<Self> {
        // most of the code in this function is based on the simple.rs example in the gimli crate
        let endian = if object.is_little_endian() {
            gimli::RunTimeEndian::Little
        } else {
            gimli::RunTimeEndian::Big
        };
        let load_section = |id: gimli::SectionId| -> result::Result<
            gimli::EndianSlice<'i, gimli::RunTimeEndian>,
            gimli::Error,
        > {
            let empty = Ok(gimli::EndianSlice::new(&[], endian));
            match object.section_by_name(id.name()) {
                Some(ref section) => {
                    if let Ok(data) = section.compressed_data() {
                        if data.format == object::CompressionFormat::None {
                            return Ok(gimli::EndianSlice::new(&data.data, endian));
                        }
                    }
                    empty
                }
                None => empty,
            }
        };
        // Load a supplementary section. We don't have a supplementary object file,
        // so always return an empty slice.
        let load_section_sup = |_| Ok(gimli::EndianSlice::new(&[], endian));
        // Load all of the sections.
        let dwarf = gimli::Dwarf::load(&load_section, &load_section_sup);
        let dwarf = dwarf.map_err(|e| {
            Error(ErrorImpl {
                code: ErrorCode::Gimli(e),
            })
        })?;
        Ok(DebugInfoParser {
            object,
            dwarf,
            options,
        })
    }
pub fn new ( options : & ' i DebugInfoBuilder , object : & ' i object :: File < ' i > ) -> Result < Self > { // most of the code in this function is based on the simple.rs example in the gimli crate let endian = if object . is_little_endian ( ) { gimli :: RunTimeEndian :: Little } else { gimli :: RunTimeEndian :: Big } ; let load_section = | id : gimli :: SectionId | -> result :: Result < gimli :: EndianSlice < ' i , gimli :: RunTimeEndian > , gimli :: Error , > { let empty = Ok ( gimli :: EndianSlice :: new ( & [ ] , endian ) ) ; match object . section_by_name ( id . name ( ) ) { Some ( ref section ) => { if let Ok ( data ) = section . compressed_data ( ) { if data . format == object :: CompressionFormat :: None { return Ok ( gimli :: EndianSlice :: new ( & data . data , endian ) ) ; } } empty } None => empty , } } ; // Load a supplementary section. We don't have a supplementary object file, // so always return an empty slice. let load_section_sup = | _ | Ok ( gimli :: EndianSlice :: new ( & [ ] , endian ) ) ; // Load all of the sections. let dwarf = gimli :: Dwarf :: load ( & load_section , & load_section_sup ) ; let dwarf = dwarf . map_err ( | e | { Error ( ErrorImpl { code : ErrorCode :: Gimli ( e ) , } ) } ) ? ; Ok ( DebugInfoParser { object , dwarf , options , } ) }
parse the data in an existing object
parse the data in an existing object
options
&'i DebugInfoBuilder
object
&'i object::File<'i>
options
&'i DebugInfoBuilder
object
&'i object::File<'i>