coverage: Add debugging flag -Zcoverage-options=no-mir-spans
When set, this flag skips the code that normally extracts coverage spans from MIR statements and terminators. That sometimes makes it easier to debug branch coverage and MC/DC coverage, because the coverage output is less noisy. For internal debugging only. If other code changes would make it hard to keep supporting this flag, remove it.
This commit is contained in:
parent
e23ae72ac7
commit
abc2c702af
10 changed files with 235 additions and 21 deletions
|
@ -149,7 +149,14 @@ pub enum InstrumentCoverage {
|
|||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Default)]
|
||||
pub struct CoverageOptions {
|
||||
pub level: CoverageLevel,
|
||||
// Other boolean or enum-valued options might be added here.
|
||||
|
||||
/// `-Z coverage-options=no-mir-spans`: Don't extract block coverage spans
|
||||
/// from MIR statements/terminators, making it easier to inspect/debug
|
||||
/// branch and MC/DC coverage mappings.
|
||||
///
|
||||
/// For internal debugging only. If other code changes would make it hard
|
||||
/// to keep supporting this flag, remove it.
|
||||
pub no_mir_spans: bool,
|
||||
}
|
||||
|
||||
/// Controls whether branch coverage or MC/DC coverage is enabled.
|
||||
|
|
|
@ -395,7 +395,8 @@ mod desc {
|
|||
pub const parse_optimization_fuel: &str = "crate=integer";
|
||||
pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
|
||||
pub const parse_instrument_coverage: &str = parse_bool;
|
||||
pub const parse_coverage_options: &str = "`block` | `branch` | `condition` | `mcdc`";
|
||||
pub const parse_coverage_options: &str =
|
||||
"`block` | `branch` | `condition` | `mcdc` | `no-mir-spans`";
|
||||
pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`";
|
||||
pub const parse_unpretty: &str = "`string` or `string=string`";
|
||||
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
|
||||
|
@ -963,6 +964,7 @@ mod parse {
|
|||
"branch" => slot.level = CoverageLevel::Branch,
|
||||
"condition" => slot.level = CoverageLevel::Condition,
|
||||
"mcdc" => slot.level = CoverageLevel::Mcdc,
|
||||
"no-mir-spans" => slot.no_mir_spans = true,
|
||||
_ => return false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -363,6 +363,11 @@ impl Session {
|
|||
&& self.opts.unstable_opts.coverage_options.level >= CoverageLevel::Mcdc
|
||||
}
|
||||
|
||||
/// True if `-Zcoverage-options=no-mir-spans` was passed.
|
||||
pub fn coverage_no_mir_spans(&self) -> bool {
|
||||
self.opts.unstable_opts.coverage_options.no_mir_spans
|
||||
}
|
||||
|
||||
pub fn is_sanitizer_cfi_enabled(&self) -> bool {
|
||||
self.opts.unstable_opts.sanitizer.contains(SanitizerSet::CFI)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue