pub(crate) struct MemoryMappedBinary {
base: *mut c_void,
size: usize,
unwind_registry: Option<UnwindRegistry>,
frame_info_registration: Option<GlobalFrameInfoRegistration>,
}Fields§
§base: *mut c_void§size: usize§unwind_registry: Option<UnwindRegistry>§frame_info_registration: Option<GlobalFrameInfoRegistration>Implementations§
Source§impl MemoryMappedBinary
impl MemoryMappedBinary
Sourcepub(crate) fn try_from_bytes<'a, R: ReadRef<'a>>(
object_file: &File<'a, R>,
data: &[u8],
) -> Result<Self, String>
pub(crate) fn try_from_bytes<'a, R: ReadRef<'a>>( object_file: &File<'a, R>, data: &[u8], ) -> Result<Self, String>
Maps object_file’s load segments into a freshly allocated, private
virtual address range, copying segment bytes out of the in-memory
data buffer (rather than mapping a file directly).
Sourcepub(crate) fn try_from_file<'a, R: ReadRef<'a>>(
object_file: &File<'a, R>,
file: RawFd,
) -> Result<Self, String>
pub(crate) fn try_from_file<'a, R: ReadRef<'a>>( object_file: &File<'a, R>, file: RawFd, ) -> Result<Self, String>
Maps an ELF image’s load segments directly from an open file.
fn try_from_source<'a, R: ReadRef<'a>>( object_file: &File<'a, R>, data: Option<&[u8]>, file: Option<RawFd>, ) -> Result<Self, String>
fn new_mmap(size: usize) -> Result<Self, String>
pub(crate) fn base(&self) -> *mut c_void
pub(crate) fn register_frame_info( &mut self, frame_info: GlobalFrameInfoRegistration, )
Sourceunsafe fn as_slice(&self) -> &[u8] ⓘ
unsafe fn as_slice(&self) -> &[u8] ⓘ
Returns the mapped memory as a byte slice tied to the lifetime of this map.
§Safety
The entire mapped range must be readable for the returned slice’s lifetime.
pub(crate) fn publish_eh_frame_section( &mut self, address: u64, size: u64, ) -> Result<(), String>
Sourcefn map_zero(
&self,
offset: usize,
size: usize,
protection: i32,
) -> Result<(), String>
fn map_zero( &self, offset: usize, size: usize, protection: i32, ) -> Result<(), String>
Maps an anonymous zero-filled region at offset with the given
protection (used for a segment’s BSS tail).
Sourcefn map_file(
&self,
offset: usize,
size: usize,
protection: i32,
file: RawFd,
file_offset: usize,
) -> Result<(), String>
fn map_file( &self, offset: usize, size: usize, protection: i32, file: RawFd, file_offset: usize, ) -> Result<(), String>
Maps a region at offset directly from a file.
Sourcefn map_copy(
&self,
offset: usize,
size: usize,
protection: i32,
data: &[u8],
file_offset: usize,
) -> Result<(), String>
fn map_copy( &self, offset: usize, size: usize, protection: i32, data: &[u8], file_offset: usize, ) -> Result<(), String>
Maps an anonymous region at offset and copies size bytes from
data[file_offset..] into it, then applies the final protection.
Copying (rather than mapping the backing file directly) keeps this
portable: on macOS/Mach-O a file-backed MAP_FIXED mapping cannot be
created with executable protection, and here we don’t need a real
file descriptor for the image at all.
Trait Implementations§
Source§impl Drop for MemoryMappedBinary
Available on Unix only.
impl Drop for MemoryMappedBinary
impl Send for MemoryMappedBinary
impl Sync for MemoryMappedBinary
Auto Trait Implementations§
impl Freeze for MemoryMappedBinary
impl RefUnwindSafe for MemoryMappedBinary
impl Unpin for MemoryMappedBinary
impl UnwindSafe for MemoryMappedBinary
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more