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

Method get_unreached_blocks

hail-fuzz/src/coverage.rs:411–432  ·  view source on GitHub ↗

Returns the blocks corresponding to the bits indexed by `target` that are not set.

(&self, vm: &mut Vm, target: &[u32])

Source from the content-addressed store, hash-verified

409
410 /// Returns the blocks corresponding to the bits indexed by `target` that are not set.
411 pub fn get_unreached_blocks(&self, vm: &mut Vm, target: &[u32]) -> Vec<u64> {
412 self.update_mapping_cache(vm);
413 let mapping = self.mapping_cache.borrow();
414
415 let cov: &[u64] = bytemuck::cast_slice(vm.cpu.trace[self.storage].data());
416 if self.pack_bits {
417 target
418 .iter()
419 .copied()
420 .filter(|bit| !is_bit_set(cov, *bit))
421 .map(|bit| mapping.get(bit as usize).map_or(0, |(addr, _)| *addr))
422 .collect()
423 }
424 else {
425 target
426 .iter()
427 .enumerate()
428 .filter(|(_, entry)| **entry == 0)
429 .map(|(i, _)| mapping.get(i).map_or(0, |(addr, _)| *addr))
430 .collect()
431 }
432 }
433
434 /// Update the mapping of blocks IDs to addresses if the mapping has changed.
435 fn update_mapping_cache(&self, vm: &mut Vm) {

Callers 1

logMethod · 0.80

Calls 3

is_bit_setFunction · 0.85
update_mapping_cacheMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected