Struct symbolic_debuginfo::macho::MachArchive
source · pub struct MachArchive<'d>(/* private fields */);
Expand description
An archive that can consist of a single MachObject
or a FatMachO
container.
Executables and dSYM files on macOS can be a so-called Fat Mach Object: It contains multiple objects for several architectures. When loading this object, the operating system determines the object corresponding to the host’s architecture. This allows to distribute a single binary with optimizations for specific CPUs, which is frequently done on iOS.
To abstract over the differences, MachArchive
simulates the archive interface also for single
Mach objects. This allows uniform access to both file types.
Implementations§
source§impl<'d> MachArchive<'d>
impl<'d> MachArchive<'d>
sourcepub fn test(data: &[u8]) -> bool
pub fn test(data: &[u8]) -> bool
Tests whether the buffer contains either a Mach Object or a Fat Mach Object.
sourcepub fn parse(data: &'d [u8]) -> Result<Self, MachError>
pub fn parse(data: &'d [u8]) -> Result<Self, MachError>
Tries to parse a Mach archive from the given slice.
sourcepub fn objects(&self) -> MachObjectIterator<'d, '_> ⓘ
pub fn objects(&self) -> MachObjectIterator<'d, '_> ⓘ
Returns an iterator over all objects contained in this archive.
sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Returns the number of objects in this archive.
sourcepub fn object_by_index(
&self,
index: usize,
) -> Result<Option<MachObject<'d>>, MachError>
pub fn object_by_index( &self, index: usize, ) -> Result<Option<MachObject<'d>>, MachError>
Resolves the object at the given index.
Returns Ok(None)
if the index is out of bounds, or Err
if the object exists but cannot
be parsed.