Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d13e851

Browse files
Zalathartshepang
authored andcommitted
Prominently mention profiler = true on the coverage page
Enabling the profiler runtime is an essential part of being able to properly work on the coverage instrumentation code. There's already a mention of it on this page, but it's made in passing and is easy to miss. This patch adds a much more prominent section containing recommended `config.toml` settings, including `profiler = true`.
1 parent 84ea9ec commit d13e851

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎src/llvm-coverage-instrumentation.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,32 @@ Detailed instructions and examples are documented in the
3434
[coverage map]: https://llvm.org/docs/CoverageMappingFormat.html
3535
[rustc-book-instrument-coverage]: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html
3636

37+
## Recommended `config.toml` settings
38+
39+
When working on the coverage instrumentation code, it is usually necessary to
40+
**enable the profiler runtime** by setting `profiler = true` in `[build]`.
41+
This allows the compiler to produce instrumented binaries, and makes it possible
42+
to run the full coverage test suite.
43+
44+
Enabling debug assertions in the compiler and in LLVM is recommended, but not
45+
mandatory.
46+
47+
```toml
48+
# Similar to the "compiler" profile, but also enables debug assertions in LLVM.
49+
# These assertions can detect malformed coverage mappings in some cases.
50+
profile = "codegen"
51+
52+
[build]
53+
# IMPORTANT: This tells the build system to build the LLVM profiler runtime.
54+
# Without it, the compiler can't produce coverage-instrumented binaries,
55+
# and many of the coverage tests will be skipped.
56+
profiler = true
57+
58+
[rust]
59+
# Enable debug assertions in the compiler.
60+
debug-assertions = true
61+
```
62+
3763
## Rust symbol mangling
3864

3965
`-C instrument-coverage` automatically enables Rust symbol mangling `v0` (as
@@ -292,6 +318,10 @@ These tests compile and run a test program with coverage
292318
instrumentation, then use LLVM tools to convert the coverage data into a
293319
human-readable coverage report.
294320

321+
> Tests in `coverage-run` mode have an implicit `// needs-profiler-support`
322+
> directive, so they will be skipped if the profiler runtime has not been
323+
> [enabled in `config.toml`](#recommended-configtoml-settings).
324+
295325
Finally, the [`coverage-llvmir`] test compiles a simple Rust program
296326
with `-C instrument-coverage` and compares the compiled program's LLVM IR to
297327
expected LLVM IR instructions and structured data for a coverage-enabled

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /