Attribute Macro panda_macros::insn_translate
source · #[insn_translate]
Expand description
(Callback) Called before the translation of each instruction.
Callback ID: PANDA_CB_INSN_TRANSLATE
Arguments:
CPUState *env: the current CPU state
target_ptr_t pc: the guest PC we are about to translate
Helper call location: panda/target/ARCH/translate.c
Return value:
true if PANDA should insert instrumentation into the generated code,
false otherwise
Notes:
This allows a plugin writer to instrument only a small number of
instructions, avoiding the performance hit of instrumenting everything.
If you do want to instrument every single instruction, just return
true. See the documentation for PANDA_CB_INSN_EXEC for more detail.
Callback arguments: (&mut CPUState
, target_ptr_t
, )
Example
use panda::prelude::*;
#[panda::insn_translate]
fn callback(_: &mut CPUState, _: target_ptr_t, ) -> bool {
// do stuff
}