Document -Zinstrument-coverage#78616
Conversation
016ca3d to
179ac85
Compare
There was a problem hiding this comment.
| First, edit the `config.toml` file, and find the `profiler` feature entry. It may be commented out: | |
| ```toml | |
| # Build the profiler runtime (required when compiling with options that depend | |
| # on this runtime, such as `-C profile-generate` or `-Z instrument-coverage`). | |
| #profiler = false | |
| ``` | |
| Uncomment the feature entry and set it to `true`: | |
| ```toml | |
| profiler = true | |
| First, edit the `config.toml` file, and find the `profiler` feature entry. Uncomment it and set it to `true`: | |
| ```toml | |
| # Build the profiler runtime (required when compiling with options that depend | |
| # on this runtime, such as `-C profile-generate` or `-Z instrument-coverage`). | |
| profiler = true |
The phrasing here is a bit verbose.
There was a problem hiding this comment.
I'd remove the ls example here. Again, to verbose for my taste.
179ac85 to
a8dfb26
Compare
|
|
||
| Then rebuild the Rust compiler (see [rustc-dev-guide-how-to-build-and-run]). | ||
|
|
||
| ### Building the demangler |
There was a problem hiding this comment.
We could also point to rustfilt, which can be installed with cargo and doesn't require a rust checkout.
There was a problem hiding this comment.
I hadn't heard about rustfilt before! That's a great option as well.
|
|
||
| ## Enable coverage profiling in the Rust compiler | ||
|
|
||
| *IMPORTANT:* Rust's coverage profiling features may not be enabled, by default. To enable them, you may need to build a version of the Rust compiler with the `profiler` feature enabled. |
There was a problem hiding this comment.
Many of the tier 1 distributions ship with this enabled (grep for --enable-profiler)
There was a problem hiding this comment.
As discussed offline, I now discuss using nightly as an option
| Raw profiles have to be indexed before they can be used to generate coverage reports. This is done using [`llvm-profdata merge`] (which can combine multiple raw profiles and index them at the same time): | ||
|
|
||
| ```shell | ||
| $ $HOME/rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-profdata merge \ |
There was a problem hiding this comment.
Maybe we can show / mention doing it with system LLVM instead of requiring a rust build?
(Unless it has to match the exact LLVM version?)
|
@bors delegate+ |
|
✌️ @richkadel can now approve this pull request |
f2fe33b to
6d94911
Compare
|
@bors rollup=always r=tmandry |
|
📌 Commit 6d94911 has been approved by |
…r=tmandry Document -Zinstrument-coverage r? `@tmandry` FYI `@wesleywiser` Here is my proposed document for LLVM source-based code coverage. I based it on the `profile.md` page, in the same directory, and on the Clang guide for LLVM source-based coverage.
Rollup of 8 pull requests Successful merges: - rust-lang#78376 (Treat trailing semicolon as a statement in macro call) - rust-lang#78400 (Fix unindent in doc comments) - rust-lang#78575 (Add a test for compiletest rustc-env & unset-rustc-env directives) - rust-lang#78616 (Document -Zinstrument-coverage) - rust-lang#78663 (Fix ICE when a future-incompat-report has its command-line level capped) - rust-lang#78664 (Fix intrinsic size_of stable link) - rust-lang#78668 (inliner: Remove redundant loop) - rust-lang#78676 (add mipsel-unknown-none target) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
r? @tmandry
FYI @wesleywiser
Here is my proposed document for LLVM source-based code coverage.
I based it on the
profile.mdpage, in the same directory, and on the Clang guide for LLVM source-based coverage.