diff --git a/src/elf.rs b/src/elf.rs index fe583eac0..d3f004a6c 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -394,6 +394,21 @@ impl Executable { bytes: &[u8], loader: Arc>, ) -> Result { + println!("{:X?}", elf.file_header()); + for header in elf.program_header_table().iter() { + println!("{:X?}", header); + } + for header in elf.section_header_table().iter() { + println!( + "{} {:X?}", + elf.section_name(header.sh_name) + .ok() + .and_then(|bytes| std::str::from_utf8(bytes).ok()) + .map(|str| str.to_string()) + .unwrap(), + header + ); + } const EXPECTED_PROGRAM_HEADERS: [(u32, u32, u64); 4] = [ (PT_LOAD, PF_R | PF_X, ebpf::MM_PROGRAM_START), // byte code (PT_LOAD, PF_R, ebpf::MM_PROGRAM_START), // read only data @@ -478,6 +493,15 @@ impl Executable { .saturating_sub(text_section.sh_addr) .checked_div(ebpf::INSN_SIZE as u64) .unwrap_or_default() as usize; + println!( + "{} {:X}", + elf.symbol_name(symbol.st_name as Elf64Word) + .ok() + .and_then(|bytes| std::str::from_utf8(bytes).ok()) + .map(|str| str.to_string()) + .unwrap(), + target_pc + ); function_registry .register_function( target_pc as u32,