Struct xgadget::gadget::Gadget [−][src]
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]
instrs: Vec<Instruction>,
full_matches: BTreeSet<u64>,
bin_cnt: usize
) -> Self
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]
&self,
att_syntax: bool,
color: bool
) -> Box<dyn DisplayLen + Send>
String format gadget instructions
pub fn fmt_first_full_match_addr(
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
String format first full match address, if any
pub fn fmt_partial_match_addrs(
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
String format partial match addresses, if any
pub fn fmt_best_match_addrs(
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
[src]
&self,
color: bool
) -> Option<Box<dyn DisplayLen + Send>>
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]
&self,
att_syntax: bool,
color: bool
) -> Option<(Box<dyn DisplayLen + Send>, Box<dyn DisplayLen + Send>)>
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]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Gadget<'_>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,