Skip to main content

Crate drcov

Crate drcov 

Source
Expand description

§drcov

A high-quality, idiomatic, and self-contained Rust library for parsing and writing DrCov coverage files.

This library provides a complete implementation for reading and writing DrCov coverage files, supporting format version 2 with module table versions 2-4 and legacy module tables.

§References

§Example Usage

use drcov::{CoverageData, ModuleTableVersion};

// Reading a file
let coverage = drcov::from_file("coverage.drcov").unwrap();

// Creating coverage data using the builder
let new_coverage = CoverageData::builder()
    .flavor("my_tool")
    .module_version(ModuleTableVersion::V4)
    .add_module("/bin/program", 0x400000, 0x450000)
    .add_module("/lib/libc.so", 0x7fff00000000, 0x7fff00100000)
    .add_coverage(0, 0x1000, 32) // module 0, offset 0x1000, size 32
    .build()
    .unwrap();

// Writing to a file
drcov::to_file(&new_coverage, "output.drcov").unwrap();

Structs§

BasicBlock
Represents an executed basic block.
CoverageBuilder
A builder for creating CoverageData instances.
CoverageData
Complete drcov coverage data structure.
FileHeader
DrCov file header containing version and tool information.
ModuleEntry
Represents a loaded module/library in the traced process.

Enums§

Error
Represents errors that can occur during drcov file processing.
ModuleTableVersion
Module table format versions.

Functions§

from_file
Parses a drcov file from a file path.
from_reader
Parses a drcov file from any reader.
to_file
Writes coverage data to a file path.
to_writer
Writes coverage data to any writer.

Type Aliases§

Result
A specialized Result type for drcov operations.