Prechádzať zdrojové kódy

Add start_address and end_address methods to ElfSection too

Philipp Oppermann 9 rokov pred
rodič
commit
33d19ac1bb
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      src/elf_sections.rs

+ 8 - 0
src/elf_sections.rs

@@ -62,6 +62,14 @@ pub struct ElfSection {
 }
 
 impl ElfSection {
+    pub fn start_address(&self) -> usize {
+        self.addr as usize
+    }
+
+    pub fn end_address(&self) -> usize {
+        (self.addr + self.size) as usize
+    }
+
     pub fn flags(&self) -> ElfSectionFlags {
         ElfSectionFlags::from_bits_truncate(self.flags)
     }