fn report_unresolved_symbol(&self, insn_offset: usize) -> Result<u64, EbpfError<E>> {
        let file_offset = insn_offset
            .saturating_mul(ebpf::INSN_SIZE)
            .saturating_add(self.text_section_info.offset_range.start as usize);

        let mut name = "Unknown";
        if let Ok(elf) = Elf::parse(&self.elf_bytes) {
            for relocation in &elf.dynrels {
                if let Some(BPFRelocationType::R_BPF_64_32) =
                    BPFRelocationType::from_x86_relocation_type(relocation.r_type)
                {
                    if relocation.r_offset as usize == file_offset {
                        let sym = elf
                            .dynsyms
                            .get(relocation.r_sym)
                            .ok_or(ELFError::UnknownSymbol(relocation.r_sym))?;
                        name = elf
                            .dynstrtab
                            .get(sym.st_name)
                            .ok_or(ELFError::UnknownSymbol(sym.st_name))?
                            .map_err(|_| ELFError::UnknownSymbol(sym.st_name))?;
                    }
                }
            }
        }
        Err(ELFError::UnresolvedSymbol(
            name.to_string(),
            file_offset / ebpf::INSN_SIZE + ebpf::ELF_INSN_DUMP_OFFSET,
            file_offset,
        )
        .into())
    }
/// Report information on a symbol that failed to be resolved
Report information on a symbol that failed to be resolved
Report information on a symbol that failed to be resolved
fn report_unresolved_symbol(&self, insn_offset: usize) -> Result<u64, EbpfError<E>> {
        let file_offset = insn_offset
            .saturating_mul(ebpf::INSN_SIZE)
            .saturating_add(self.text_section_info.offset_range.start as usize);
        let mut name = "Unknown";
        if let Ok(elf) = Elf::parse(&self.elf_bytes) {
            for relocation in &elf.dynrels {
                if let Some(BPFRelocationType::R_BPF_64_32) =
                    BPFRelocationType::from_x86_relocation_type(relocation.r_type)
                {
                    if relocation.r_offset as usize == file_offset {
                        let sym = elf
                            .dynsyms
                            .get(relocation.r_sym)
                            .ok_or(ELFError::UnknownSymbol(relocation.r_sym))?;
                        name = elf
                            .dynstrtab
                            .get(sym.st_name)
                            .ok_or(ELFError::UnknownSymbol(sym.st_name))?
                            .map_err(|_| ELFError::UnknownSymbol(sym.st_name))?;
                    }
                }
            }
        }
        Err(ELFError::UnresolvedSymbol(
            name.to_string(),
            file_offset / ebpf::INSN_SIZE + ebpf::ELF_INSN_DUMP_OFFSET,
            file_offset,
        )
        .into())
    }
fn report_unresolved_symbol ( & self , insn_offset : usize ) -> Result < u64 , EbpfError < E > > { let file_offset = insn_offset . saturating_mul ( ebpf :: INSN_SIZE ) . saturating_add ( self . text_section_info . offset_range . start as usize ) ; let mut name = " " ; if let Ok ( elf ) = Elf :: parse ( & self . elf_bytes ) { for relocation in & elf . dynrels { if let Some ( BPFRelocationType :: R_BPF_64_32 ) = BPFRelocationType :: from_x86_relocation_type ( relocation . r_type ) { if relocation . r_offset as usize == file_offset { let sym = elf . dynsyms . get ( relocation . r_sym ) . ok_or ( ELFError :: UnknownSymbol ( relocation . r_sym ) ) ? ; name = elf . dynstrtab . get ( sym . st_name ) . ok_or ( ELFError :: UnknownSymbol ( sym . st_name ) ) ? . map_err ( | _ | ELFError :: UnknownSymbol ( sym . st_name ) ) ? ; } } } } Err ( ELFError :: UnresolvedSymbol ( name . to_string ( ) , file_offset / ebpf :: INSN_SIZE + ebpf :: ELF_INSN_DUMP_OFFSET , file_offset , ) . into ( ) ) }
Report information on a symbol that failed to be resolved
Report information on a symbol that failed to be resolved
&self
insn_offset
usize