An assortment of helpers that I've found to be useful when writing Binary Ninja plug-ins in Rust.
Upstreamed! See the activity module.
Types and macros to simplify matching over
LowLevelILInstruction
and LowLevelILExpression
can be found in the llil module.
match_instr!{
instr,
// Basic patterns
CallSsa(ConstPtr(address), _) => println!("Direct call to {:#x}", address),
// Variable bindings and guards
instr @ SetRegSsa(dest, add @ Add(RegSsa(src), Const(value))) if value > 10 => {
println!(
"Increment of {src:?} by {value} > 10 at {:#x} (dest={dest:?}, add={add:?})",
instr.address(),
);
},
// OR patterns
CallSsa(_, _) | TailCallSsa(_, _) => println!("Function call"),
_ => {}
};