LCOV - code coverage report
Current view: top level - src/dsc - mapping_info.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 35 0
Test Date: 2024-11-30:00:00:00 Functions: 0.0 % 8 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::common::FromFFI;
       4              : use std::marker::PhantomData;
       5              : 
       6              : /// This structure represents a `dyld_cache_mapping_info` entry.
       7              : ///
       8              : /// It provides information about the relationshiop between on-disk shared cache
       9              : /// and in-memory shared cache.
      10              : pub struct MappingInfo<'a> {
      11              :     ptr: cxx::UniquePtr<ffi::dsc_MappingInfo>,
      12              :     _owner: PhantomData<&'a ()>,
      13              : }
      14              : 
      15              : impl FromFFI<ffi::dsc_MappingInfo> for MappingInfo<'_> {
      16            0 :     fn from_ffi(ptr: cxx::UniquePtr<ffi::dsc_MappingInfo>) -> Self {
      17            0 :         Self {
      18            0 :             ptr,
      19            0 :             _owner: PhantomData,
      20            0 :         }
      21            0 :     }
      22              : }
      23              : 
      24              : impl MappingInfo<'_> {
      25              :     /// The in-memory address where this dyld shared cache region is mapped
      26            0 :     pub fn address(&self) -> u64 {
      27            0 :         self.ptr.address()
      28            0 :     }
      29              : 
      30              :     /// Size of the region being mapped
      31            0 :     pub fn size(&self) -> u64 {
      32            0 :         self.ptr.size()
      33            0 :     }
      34              : 
      35              :     /// End virtual address of the region
      36            0 :     pub fn end_address(&self) -> u64 {
      37            0 :         self.ptr.end_address()
      38            0 :     }
      39              : 
      40              :     /// On-disk file offset
      41            0 :     pub fn file_offset(&self) -> u64 {
      42            0 :         self.ptr.file_offset()
      43            0 :     }
      44              : 
      45              :     /// Max memory protection
      46            0 :     pub fn max_prot(&self) -> u32 {
      47            0 :         self.ptr.max_prot()
      48            0 :     }
      49              : 
      50              :     /// Initial memory protection
      51            0 :     pub fn init_prot(&self) -> u32 {
      52            0 :         self.ptr.init_prot()
      53            0 :     }
      54              : }
      55              : 
      56              : impl std::fmt::Debug for MappingInfo<'_> {
      57            0 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      58            0 :         f.debug_struct("MappingInfo")
      59            0 :             .field("address", &self.address())
      60            0 :             .field("end_address", &self.end_address())
      61            0 :             .field("size", &self.size())
      62            0 :             .field("file_offset", &self.file_offset())
      63            0 :             .field("max_prot", &self.max_prot())
      64            0 :             .field("init_prot", &self.init_prot())
      65            0 :             .finish()
      66            0 : 
      67            0 :     }
      68              : }
        

Generated by: LCOV version 2.1-1