pub struct TranslationBlock<'a> { /* private fields */ }Expand description
Wrapper structure for a qemu_plugin_tb *
§Safety
This structure is safe to use as long as the pointer is valid. The pointer is always opaque, and therefore may not be dereferenced.
§Example
struct MyPlugin;
impl qemu_plugin::plugin::Register for MyPlugin {}
impl qemu_plugin::plugin::HasCallbacks for MyPlugin {
fn on_translation_block_translate(
&mut self,
id: qemu_plugin::PluginId,
tb: qemu_plugin::TranslationBlock,
) -> Result<()> {
for insn in tb.instructions() {
println!("{:08x}: {}", insn.vaddr(), insn.disas()?);
}
Ok(())
}
}Implementations§
Source§impl<'a> TranslationBlock<'a>
impl<'a> TranslationBlock<'a>
Sourcepub fn instruction(&'a self, index: usize) -> Result<Instruction<'a>>
pub fn instruction(&'a self, index: usize) -> Result<Instruction<'a>>
Returns the instruction in the translation block at index. If the index is out of bounds,
an error is returned.
§Arguments
index: The index of the instruction to return
Sourcepub fn instructions(&'a self) -> TranslationBlockIterator<'a> ⓘ
pub fn instructions(&'a self) -> TranslationBlockIterator<'a> ⓘ
Returns an iterator over the instructions in the translation block
Sourcepub fn register_execute_callback<F>(&self, cb: F)
pub fn register_execute_callback<F>(&self, cb: F)
Register a callback to be run on execution of this translation block
§Arguments
cb: The callback to be run
Sourcepub fn register_execute_callback_flags<F>(&self, cb: F, flags: CallbackFlags)
pub fn register_execute_callback_flags<F>(&self, cb: F, flags: CallbackFlags)
Register a callback to be run on execution of this translation block
§Arguments
cb: The callback to be run
Sourcepub fn register_conditional_execute_callback<F>(
&self,
cb: F,
cond: PluginCondition,
entry: PluginU64,
immediate: u64,
)
pub fn register_conditional_execute_callback<F>( &self, cb: F, cond: PluginCondition, entry: PluginU64, immediate: u64, )
Register a callback to be conditionally run on execution of this translation block
§Arguments
cb: The callback to be runcond: The condition for the callback to be runentryThe entry to increment the scoreboard forimmediate: The immediate value to use for the callback
Sourcepub fn register_conditional_execute_callback_flags<F>(
&self,
cb: F,
flags: CallbackFlags,
cond: PluginCondition,
entry: PluginU64,
immediate: u64,
)
pub fn register_conditional_execute_callback_flags<F>( &self, cb: F, flags: CallbackFlags, cond: PluginCondition, entry: PluginU64, immediate: u64, )
Register a callback to be conditionally run on execution of this translation block
§Arguments
cb: The callback to be runflags: The flags for the callbackcond: The condition for the callback to be runentry: The entry to increment the scoreboard forimmediate: The immediate value to use for the callback
Trait Implementations§
Source§impl<'a> From<*mut qemu_plugin_tb> for TranslationBlock<'a>
impl<'a> From<*mut qemu_plugin_tb> for TranslationBlock<'a>
Source§fn from(tb: *mut qemu_plugin_tb) -> Self
fn from(tb: *mut qemu_plugin_tb) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for TranslationBlock<'a>
impl<'a> RefUnwindSafe for TranslationBlock<'a>
impl<'a> Send for TranslationBlock<'a>
impl<'a> Sync for TranslationBlock<'a>
impl<'a> Unpin for TranslationBlock<'a>
impl<'a> UnwindSafe for TranslationBlock<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more