MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / register_cstr_printer

Function register_cstr_printer

hail-fuzz/src/debugging/check.rs:561–570  ·  view source on GitHub ↗
(vm: &mut Vm, addr: u64, reg: &str)

Source from the content-addressed store, hash-verified

559}
560
561fn register_cstr_printer(vm: &mut Vm, addr: u64, reg: &str) {
562 tracing::debug!("registering `cstr({reg})` hook at {addr:#x}");
563 let reg = vm.cpu.arch.sleigh.get_varnode(reg).unwrap();
564 let mut buf = [0; 64];
565 vm.hook_address(addr, move |cpu: &mut icicle_vm::cpu::Cpu, _| {
566 let ptr = cpu.read_var::<u32>(reg) as u64;
567 print!("{}", read_cstr(&mut buf, cpu, ptr).as_bstr());
568 let _ = std::io::stdout().flush();
569 });
570}
571
572fn read_cstr<'a>(buf: &'a mut [u8], cpu: &mut icicle_vm::cpu::Cpu, ptr: u64) -> &'a [u8] {
573 buf[0] = 0;

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected