[−][src]Module rustc_mir::transform::coverage::debug

The InstrumentCoverage MIR pass implementation includes debugging tools and options to help developers understand and/or improve the analysis and instrumentation of a MIR.

To enable coverage, include the rustc command line option:

MIR Dump Files, with additional CoverageGraph graphviz and CoverageSpan spanview

Additional debugging options include:

Debug Logging

The InstrumentCoverage pass includes debug logging messages at various phases and decision points, which can be enabled via environment variable:

RUSTC_LOG=rustc_mir::transform::coverage=debug

Other module paths with coverage-related debug logs may also be of interest, particularly for debugging the coverage map data, injected as global variables in the LLVM IR (during rustc's code generation pass). For example:

RUSTC_LOG=rustc_mir::transform::coverage,rustc_codegen_ssa::coverageinfo,rustc_codegen_llvm::coverageinfo=debug

Coverage Debug Options

Additional debugging options can be enabled using the environment variable:

RUSTC_COVERAGE_DEBUG_OPTIONS=<options>

These options are comma-separated, and specified in the format option-name=value. For example:

$ RUSTC_COVERAGE_DEBUG_OPTIONS=counter-format=id+operation,allow-unused-expressions=yes cargo build

Coverage debug options include:

Structs

DebugCounter

A non-public support class to DebugCounters.

DebugCounters

If enabled, this struct maintains a map from CoverageKind IDs (as ExpressionOperandId) to the CoverageKind data and optional label (normally, the counter's associated BasicCoverageBlock format string, if any).

DebugOptions

Parses and maintains coverage-specific debug options captured from the environment variable "RUSTC_COVERAGE_DEBUG_OPTIONS", if set.

ExpressionFormat
GraphvizData

If enabled, this data structure captures additional debugging information used when generating a Graphviz (.dot file) representation of the CoverageGraph, for debugging purposes.

UsedExpressions

If enabled, this struct captures additional data used to track whether expressions were used, directly or indirectly, to compute the coverage counts for all CoverageSpans, and any that are not used are retained in the unused_expressions Vec, to be included in debug output (logs and/or a CoverageGraph graphviz output).

Constants

NESTED_INDENT
RUSTC_COVERAGE_DEBUG_OPTIONS

Functions

bcb_to_string_sections
bool_option_val
counter_format_option_val
debug_options
dump_coverage_graphviz

Generates the MIR pass coverage-specific graphviz dump file.

dump_coverage_spanview

Generates the MIR pass CoverageSpan-specific spanview dump file.

span_viewables

Converts the computed BasicCoverageBlockDatas into SpanViewables.

term_type

Returns a simple string representation of a TerminatorKind variant, indenpendent of any values it might hold.