Struct lief::dsc::DyldSharedCache
pub struct DyldSharedCache { /* private fields */ }
Expand description
This struct interfaces a dyld shared cache file.
Implementations§
pub fn filename(&self) -> String
pub fn filename(&self) -> String
Filename of the dyld shared file associated with this object.
For instance: dyld_shared_cache_arm64e, dyld_shared_cache_arm64e.62.dyldlinkedit
pub fn filepath(&self) -> String
pub fn filepath(&self) -> String
Full path to the original dyld shared cache file associated with object
(e.g. /home/lief/downloads/visionos/dyld_shared_cache_arm64e.42
)
pub fn load_address(&self) -> u64
pub fn load_address(&self) -> u64
Based address of this cache
pub fn find_lib_from_va(&self, va: u64) -> Option<Dylib<'_>>
pub fn find_lib_from_va(&self, va: u64) -> Option<Dylib<'_>>
Find the Dylib
that encompasses the given virtual address.
pub fn find_lib_from_path(&self, path: &str) -> Option<Dylib<'_>>
pub fn find_lib_from_path(&self, path: &str) -> Option<Dylib<'_>>
Find the Dylib
whose Dylib::path
matches the provided path.
pub fn find_lib_from_name(&self, name: &str) -> Option<Dylib<'_>>
pub fn find_lib_from_name(&self, name: &str) -> Option<Dylib<'_>>
Find the Dylib
whose filename of Dylib::path
matches the provided name.
If multiple libraries have the same name (but with a different path), the first one matching the provided name is returned.
pub fn has_subcaches(&self) -> bool
pub fn has_subcaches(&self) -> bool
True if the subcaches are associated with this cache
pub fn libraries(&self) -> Dylibs<'_> ⓘ
pub fn libraries(&self) -> Dylibs<'_> ⓘ
Return an iterator over the different Dylib
libraries embedded
in this dyld shared cache
pub fn mapping_info(&self) -> MappingInfoIt<'_> ⓘ
pub fn mapping_info(&self) -> MappingInfoIt<'_> ⓘ
Return an iterator over the different MappingInfo
associated
with this dyld shared cache
pub fn subcaches(&self) -> SubCacheIt<'_> ⓘ
pub fn subcaches(&self) -> SubCacheIt<'_> ⓘ
Return an interator over the subcaches associated with this (main) dyld shared cache.
pub fn disassemble(&self, address: u64) -> Instructions<'_> ⓘ
pub fn disassemble(&self, address: u64) -> Instructions<'_> ⓘ
Disassemble instructions at the provided virtual address.
This function returns an iterator over assembly::Instructions
.
pub fn get_content_from_va(&self, address: u64, size: u64) -> Vec<u8>
pub fn get_content_from_va(&self, address: u64, size: u64) -> Vec<u8>
Return the content at the specified virtual address
pub fn cache_for_address(&self, address: u64) -> Option<DyldSharedCache>
pub fn cache_for_address(&self, address: u64) -> Option<DyldSharedCache>
Find the sub-DyldSharedCache that wraps the given virtual address
pub fn main_cache(&self) -> Option<DyldSharedCache>
pub fn main_cache(&self) -> Option<DyldSharedCache>
Return the principal dyld shared cache in the case of multiple subcaches
pub fn find_subcache(&self, filename: &str) -> Option<DyldSharedCache>
pub fn find_subcache(&self, filename: &str) -> Option<DyldSharedCache>
Try to find the DyldSharedCache
associated with the filename given
in the first parameter.
pub fn va_to_offset(&self, address: u64) -> Result<u64, Error>
pub fn va_to_offset(&self, address: u64) -> Result<u64, Error>
Convert the given virtual address into an offset.
pub fn enable_caching(&self, target_cache_dir: &str)
pub fn enable_caching(&self, target_cache_dir: &str)
When enabled, this function allows to record and to keep in cache, dyld shared cache information that are costly to access.
For instance, GOT symbols, rebases information, stub symbols, …
It is highly recommended to enable this function when processing
a dyld shared cache several times or when extracting a large number of
Dylib
with enhanced extraction options (e.g. crate::dsc::dylib::ExtractOpt::fix_memory
)
One can enable caching by calling this function:
let dyld_cache = lief::dsc::load_from_path("macos-15.0.1/", "");
dyld_cache.enable_caching("/home/user/.cache/lief-dsc");
One can also enable this cache optimization globally using the
function: crate::dsc::enable_cache
or by setting the environment variable
DYLDSC_ENABLE_CACHE
to 1.
pub fn flush_cache(&self)
pub fn flush_cache(&self)
Flush internal information into the on-disk cache (see: enable_caching)