Skip to content

Commit

Permalink
Merge pull request #1928 from mlgiraud/feat/add_start_end_to_hook
Browse files Browse the repository at this point in the history
Feature: Bindings: add start end to block hook
  • Loading branch information
wtdcode authored Mar 11, 2024
2 parents e03109d + d4f5bf1 commit 227ff1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ impl<'a, D> Unicorn<'a, D> {
/// Add a block hook.
pub fn add_block_hook<F: 'a>(
&mut self,
begin: u64,
end: u64,
callback: F,
) -> Result<UcHookId, uc_error>
where
Expand All @@ -638,8 +640,8 @@ impl<'a, D> Unicorn<'a, D> {
HookType::BLOCK,
ffi::block_hook_proxy::<D, F> as _,
user_data.as_mut() as *mut _ as _,
1,
0,
begin,
end,
)
}
.and_then(|| {
Expand Down
2 changes: 1 addition & 1 deletion tests/rust-tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ fn x86_block_callback() {
assert_eq!(emu.mem_write(0x1000, &x86_code32), Ok(()));

let hook = emu
.add_block_hook(callback)
.add_block_hook(1, 0, callback)
.expect("failed to add block hook");
assert_eq!(
emu.emu_start(0x1000, 0x1002, 10 * SECOND_SCALE, 1000),
Expand Down

0 comments on commit 227ff1d

Please sign in to comment.