Skip to content

Commit 227ff1d

Browse files
authored
Merge pull request #1928 from mlgiraud/feat/add_start_end_to_hook
Feature: Bindings: add start end to block hook
2 parents e03109d + d4f5bf1 commit 227ff1d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

bindings/rust/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ impl<'a, D> Unicorn<'a, D> {
620620
/// Add a block hook.
621621
pub fn add_block_hook<F: 'a>(
622622
&mut self,
623+
begin: u64,
624+
end: u64,
623625
callback: F,
624626
) -> Result<UcHookId, uc_error>
625627
where
@@ -638,8 +640,8 @@ impl<'a, D> Unicorn<'a, D> {
638640
HookType::BLOCK,
639641
ffi::block_hook_proxy::<D, F> as _,
640642
user_data.as_mut() as *mut _ as _,
641-
1,
642-
0,
643+
begin,
644+
end,
643645
)
644646
}
645647
.and_then(|| {

tests/rust-tests/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ fn x86_block_callback() {
763763
assert_eq!(emu.mem_write(0x1000, &x86_code32), Ok(()));
764764

765765
let hook = emu
766-
.add_block_hook(callback)
766+
.add_block_hook(1, 0, callback)
767767
.expect("failed to add block hook");
768768
assert_eq!(
769769
emu.emu_start(0x1000, 0x1002, 10 * SECOND_SCALE, 1000),

0 commit comments

Comments
 (0)