Struct xgadget::gadget::Gadget[][src]

pub struct Gadget<'a> { /* fields omitted */ }

Gadget instructions (data) coupled with occurrence addresses for full and partial matches (metadata). Gadgets sortable by lowest occurrence address. Hash and equality consider only gadget instructions, not occurrence addresses (fast de-duplication via sets).

Implementations

impl<'a> Gadget<'a>[src]

pub fn new(instrs: Vec<Instruction>, occurrence_addrs: BTreeSet<u64>) -> Self[src]

Convenience constructor for single-binary gadgets.

Arguments

  • instrs - instructions, should be sorted in execution order.
  • occurrence_addrs - Addresses where gadget appears.

pub fn new_multi_bin(
    instrs: Vec<Instruction>,
    full_matches: BTreeSet<u64>,
    bin_cnt: usize
) -> Self
[src]

Constructor for multi-binary gadgets.

Arguments

  • instrs - instructions, should be sorted in execution order.
  • full_matches - full match addresses (same in all binaries).
  • bin_cnt - count of binaries for which this gadget tracks full/partial matches.

pub fn instrs(&self) -> &[Instruction][src]

Get a instructions

pub fn last_instr(&self) -> Option<&Instruction>[src]

Get tail

pub fn full_matches(&self) -> &BTreeSet<u64>[src]

Get a full matches

pub fn partial_matches(&self) -> &BTreeMap<u64, Vec<&'a Binary>>[src]

Get partial matches

pub fn first_full_match(&self) -> Option<u64>[src]

Get first full match

pub fn bin_cnt(&self) -> usize[src]

Get count of binaries for which this gadget tracks partial matches

pub fn add_partial_match(&mut self, addr: u64, bin: &'a Binary)[src]

Add a new partial match address/binary tuple

pub fn fmt_instrs(
    &self,
    att_syntax: bool,
    color: bool
) -> Box<dyn DisplayLen + Send>
[src]

String format gadget instructions

pub fn fmt_first_full_match_addr(
    &self,
    color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]

String format first full match address, if any

pub fn fmt_partial_match_addrs(
    &self,
    color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]

String format partial match addresses, if any

pub fn fmt_best_match_addrs(
    &self,
    color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]

String format match addresses, prioritizing full matches over partial, if any

pub fn fmt_for_filter(&self, att_syntax: bool) -> String[src]

pub fn fmt(
    &self,
    att_syntax: bool,
    color: bool
) -> Option<(Box<dyn DisplayLen + Send>, Box<dyn DisplayLen + Send>)>
[src]

Format a single gadget, return an (instrs, addr(s)) tuple Returns None is the gadget has no full or partial matches across binaries.

Trait Implementations

impl<'a> Clone for Gadget<'a>[src]

impl<'a> Debug for Gadget<'a>[src]

impl Eq for Gadget<'_>[src]

impl Hash for Gadget<'_>[src]

impl Ord for Gadget<'_>[src]

impl PartialEq<Gadget<'_>> for Gadget<'_>[src]

impl PartialOrd<Gadget<'_>> for Gadget<'_>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Gadget<'a>[src]

impl<'a> Send for Gadget<'a>[src]

impl<'a> Sync for Gadget<'a>[src]

impl<'a> Unpin for Gadget<'a>[src]

impl<'a> UnwindSafe for Gadget<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.