Expand description
More ergonomic matching over Binary Ninja’s low_level_il
types
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"),
_ => {}
};
NOTE: This currently only supports the operations I’ve had a need to match against. It will need to be expanded as it is used for more things.
Macros§
- match_
instr match
style pattern matching and destructuring of instructions and their expressions.- try_
let_ instr let / else
style pattern matching and destructuring of instructions and their expressions.
Structs§
Enums§
Functions§
- is_
full_ register - Checks whether a given
LowLevelILSSARegisterKind
is a full register. - is_
same_ register - Checks if two
LowLevelILSSARegisterKind
instances represent the same register, irrespective of their version. - require_
full_ register - Extract the underlying
LowLevelILRegisterKind
from aLowLevelILSSARegisterKind
if it is a full register. If not, logs a warning and returnsNone
.
Derive Macros§
- Instr
Match - Derive macro for mapping instruction pattern matching to structs.