Skip to main content

VtableIndex

Struct VtableIndex 

Source
pub struct VtableIndex {
    pub vtables: Vec<VtableEntry>,
    /* private fields */
}
Expand description

The VtableIndex type.

Fields§

§vtables: Vec<VtableEntry>

The vtables field.

Implementations§

Source§

impl VtableIndex

Source

pub fn build(macho: &MachoFile<'_>) -> Result<Self>

Performs build.

Source

pub fn build_from_source<S>(source: &S) -> Result<Self>
where S: AsRef<[u8]> + ?Sized,

Build from one borrowed thin Mach-O byte source.

The source is not copied and may be a byte slice, vector, or caller-owned read-only memory map. Universal binaries are rejected so callers select an architecture explicitly.

Source

pub fn build_limited(macho: &MachoFile<'_>, max_vtables: usize) -> Result<Self>

Builds at most max_vtables decoded vtables.

The search stops once the output limit is reached. Use Self::was_truncated to distinguish a complete result from a bounded one.

Source

pub fn build_limited_from_source<S>( source: &S, max_vtables: usize, ) -> Result<Self>
where S: AsRef<[u8]> + ?Sized,

Build at most max_vtables entries from a borrowed thin Mach-O source.

This has the same zero-copy source and universal-binary behavior as Self::build_from_source.

Source

pub fn find_by_class(&self, class_name: &str) -> Option<&VtableEntry>

Performs find_by_class.

Source

pub fn find_by_va(&self, va: Va) -> Option<&VtableEntry>

Performs find_by_va.

Source

pub fn slot_at(&self, va: Va) -> Option<(&VtableEntry, &VtableSlot)>

Performs slot_at.

Source

pub fn slots_targeting_va( &self, target_va: Va, ) -> Vec<(&VtableEntry, &VtableSlot)>

Find all vtable slots whose target points to the given function VA.

Source

pub fn vtables(&self) -> &[VtableEntry]

Performs vtables.

Source

pub fn was_truncated(&self) -> bool

Returns whether additional vtable candidates were skipped at the configured collection bound.

Source

pub fn find_slot_by_method( &self, class_name: &str, method_name: &str, ) -> Option<(&VtableEntry, &VtableSlot, usize)>

Find a vtable function slot by class name and method name.

The method name is matched against the demangled target function name of each slot. The match is substring-based: "check" matches a slot targeting "Foo::check()".

Returns the vtable entry, the matching slot, and its function-slot index (0-based, excluding the header slots).

Trait Implementations§

Source§

impl Clone for VtableIndex

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VtableIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VtableIndex

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for VtableIndex

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.