pub struct ArraySectionAccessor<'a> { /* private fields */ }
Expand description
A section data accessor intended to array tables. The accessor is useful for manipulation of such sections as .ctors, .dtors, .init_array and .fini_array
For example:
use std::fs::File;
use std::io;
use std::io::{BufReader, Error};
use elfio::Elfio;
fn main() -> io::Result<()> {
let elf_file = File::open("tests/files/hello_32")?;
let mut reader = BufReader::new(elf_file);
let mut elf = Elfio::new();
elf.load(&mut reader)?;
let section = match elf.get_section_by_name(&".ctors") {
Some(s) => s,
None => return Err(Error::new(io::ErrorKind::Other, "section not found")),
};
let array = elfio::ArraySectionAccessor::new(&elf, section);
assert_eq!(array.get_entries_num(), 2);
let element = array.get_entry(0).unwrap();
assert_eq!(element.value, 0xFFFFFFFF);
let element = array.get_entry(1).unwrap();
assert_eq!(element.value, 0x00000000);
Ok(())
}
Implementations§
Source§impl<'a> ArraySectionAccessor<'a>
impl<'a> ArraySectionAccessor<'a>
Sourcepub fn new(
elfio: &'a Elfio,
section: &'a dyn ElfSectionTrait,
) -> ArraySectionAccessor<'a>
pub fn new( elfio: &'a Elfio, section: &'a dyn ElfSectionTrait, ) -> ArraySectionAccessor<'a>
Creates a new instance of the relocation table accessor
Sourcepub fn get_entries_num(&self) -> ElfXword
pub fn get_entries_num(&self) -> ElfXword
Returns number of symbols
Auto Trait Implementations§
impl<'a> Freeze for ArraySectionAccessor<'a>
impl<'a> !RefUnwindSafe for ArraySectionAccessor<'a>
impl<'a> !Send for ArraySectionAccessor<'a>
impl<'a> !Sync for ArraySectionAccessor<'a>
impl<'a> Unpin for ArraySectionAccessor<'a>
impl<'a> !UnwindSafe for ArraySectionAccessor<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more