Skip to content

Commit 4dc521c

Browse files
authored
Update parser.rs
1 parent f36c2a3 commit 4dc521c

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

vm/src/elf/parser.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -428,29 +428,6 @@ fn parse_precompile_metadata(
428428
Ok(precompiles)
429429
}
430430

431-
#[allow(dead_code)]
432-
fn debug_segment_info(segment: &ProgramHeader, section_map: &HashMap<&str, (u64, u64)>) {
433-
println!("Program Header Information:");
434-
println!(" Segment Type: 0x{:08x}", segment.p_type);
435-
println!(" File Offset: 0x{:016x}", segment.p_offset);
436-
println!(" Virtual Address: 0x{:016x}", segment.p_vaddr);
437-
println!(" Physical Address: 0x{:016x}", segment.p_paddr);
438-
println!(" File Size: {} bytes", segment.p_filesz);
439-
println!(" Memory Size: {} bytes", segment.p_memsz);
440-
println!(" Flags: 0x{:08x}", segment.p_flags);
441-
println!(" Alignment: 0x{:016x}", segment.p_align);
442-
println!(
443-
" LOADABLE: 0x{:08x} -> 0x{:08x}",
444-
segment.p_offset,
445-
segment.p_offset + segment.p_filesz
446-
);
447-
448-
for (key, (start, end)) in section_map {
449-
if !(*end < segment.p_offset || *start > segment.p_offset + segment.p_filesz) {
450-
println!("Section {}: 0x{:08x} -> 0x{:08x}", key, start, end);
451-
}
452-
}
453-
}
454431

455432
/// Parses the segments of an ELF file and extracts relevant information.
456433
///
@@ -489,9 +466,6 @@ pub fn parse_segments(elf: &ElfBytes<LittleEndian>, data: &[u8]) -> Result<Parse
489466
.iter()
490467
.filter(|x| x.p_type == abi::PT_LOAD || x.p_type == abi::PT_NOTE)
491468
{
492-
// TODO: Uncomment this when we need to debug the segment info
493-
// #[cfg(debug_assertions)]
494-
// debug_segment_info(&segment, &section_map);
495469
// We assume the executable section (PF_X or .text section) is the first executable segment,
496470
// thus it has the lower address, we use this information to figure out the base address of the program
497471
if (segment.p_flags & abi::PF_X) != 0 && base_address > segment.p_vaddr {

0 commit comments

Comments
 (0)