Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Dec 7, 2024
1 parent fbe2640 commit 917a118
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions api/python/src/DyldSharedCache/pyDyldSharedCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ void create<dsc::DyldSharedCache>(nb::module_& m) {
},
R"doc(
Convert the given virtual address into an offset.
.. code-block:: warning
If the shared cache contains multiple subcaches,
this function needs to be called on the targeted subcache.
See :func:`~.DyldSharedCache.cache_for_address` to find the
associated subcache.
)doc"_doc, "virtual_address"_a
)

Expand Down
6 changes: 6 additions & 0 deletions api/rust/cargo/lief/src/dsc/dyld_shared_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ impl DyldSharedCache {
}

/// Convert the given virtual address into an offset.
/// <div class="warning">
/// If the shared cache contains multiple subcaches,
/// this function needs to be called on the targeted subcache.
/// </div>
///
/// See: [`DyldSharedCache::cache_for_address`]
pub fn va_to_offset(&self, address: u64) -> Result<u64, Error> {
to_result!(ffi::dsc_DyldSharedCache::va_to_offset, &self, address);
}
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/extended/dsc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ From this |lief-dsc-dyldsharedcache| object, we can inspect the embedded
dyld_cache: lief.dsc.DylibSharedCache = ...
for dylib in dyld_cache.libraries():
for dylib in dyld_cache.libraries:
print("0x{:016x}: {}".format(dylib.address, dylib.path))
.. tab:: :fa:`regular fa-file-code` C++
Expand Down
4 changes: 4 additions & 0 deletions include/LIEF/DyldSharedCache/DyldSharedCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ class LIEF_API DyldSharedCache {
std::unique_ptr<DyldSharedCache> find_subcache(const std::string& filename) const;

/// Convert the given virtual address into an offset.
///
/// \warning If the shared cache contains multiple subcaches,
/// this function needs to be called on the targeted subcache.
/// See cache_for_address() to find the associated subcache.
result<uint64_t> va_to_offset(uint64_t va) const;

/// Return the stream associated with this dyld shared cache
Expand Down

0 comments on commit 917a118

Please sign in to comment.