Skip to main content

Module showmap

Module showmap 

Source
Expand description

AFL-afl-showmap-style corpus replay.

Replays a persisted corpus through a fresh executor and emits one text file per trial (or per corpus entry). Each line has the form <id>:<count>:

  • EVM IDs use the deterministic (bytecode_hash, pc) derived from the line-coverage HitMap so that IDs are stable across forge invocations and meaningful for cross-approach analysis. Format: evm_<bytecode_hash[:16]>_<pc:04x>.
  • Sancov IDs use the deterministic guard index from the sancov bitmap: sancov_0x<index:04x>.

Counts are raw saturating-summed hitcounts across the replayed corpus.

Output is consumable by tools like riesentoaster/differential-coverage.

Structsยง

ShowmapOpts
Per-replay options.
ShowmapStats
Stats returned from a single trial replay.

Enumsยง

ShowmapDomain
Which coverage bitmap(s) to dump.

Functionsยง

accumulate_evm ๐Ÿ”’
Saturating-add per-(bytecode, pc) hits from a HitMaps snapshot into dst.
accumulate_sancov ๐Ÿ”’
Saturating-add src (u8 raw counts) into dst (u64 aggregated counts).
replay_corpus_to_showmap
Replay every corpus entry under corpus_dir and emit showmap files.
write_evm ๐Ÿ”’
Each EVM ID is evm_<bytecode_hash[:16hex]>_<pc:04x>. The 16-hex prefix (64 bits) of the keccak256 bytecode hash makes IDs deterministic across processes while keeping line lengths short.
write_sancov ๐Ÿ”’
write_showmap_file ๐Ÿ”’
Write a single showmap file. Returns 1 if a file was written, 0 if skipped (no nonzero entries).