`scripts/runtime-dead`, `scripts/qemu-build`. Four defects, each of which alone
made the instrument useless, and none of which it reported.
**1. It exited after its first banner line, with status 0.** The stale-VM guard
is `stale="$(ps … | grep '[q]emu-system-x86_64' | awk …)"`, and the healthy case
is grep finding nothing — exit 1, which under `set -o pipefail` is the whole
pipeline's status, which `set -e` turns into an abort. So the script ran past
this guard only when the condition it refuses on was already true, and returned
success without doing anything every other time. Same shape in the loop that
waits for QEMU's pid. Both now end in `|| true`.
**2. The guest-wait loop finished in under a second.** It polls
`ssh -o ConnectTimeout=4 macos-vm true` 120 times with no delay between
attempts. `ConnectTimeout` bounds a connection being *accepted slowly*; QEMU's
hostfwd **refuses** instantly until the guest is listening, so all 120 attempts
returned immediately and the script declared a guest that had another twenty
seconds to go. Added the `sleep 2`.
**3. The profile it merged was a build script's, not QEMU's.**
`LLVM_PROFILE_FILE` was a single fixed path exported before the build — and
`-C instrument-coverage` instruments the crate's build scripts too, which run
during that build and write there on exit. That is why the one run that got far
enough reported **3010 of 3010 functions never ran** on a boot whose own log
says it presented frames. `%p` per process now, the build is run explicitly so
its raw files can be swept before the boot, and every remaining raw file is
merged.
**4. The profile writer was never linked in.** `hw/display/meson.build` reads
`REIMS_VGPU_COVERAGE` with `run_command` and turns it into a `--whole-archive`
link argument — a **configure-time** decision. `qemu-build.sh` skips configure
when `build/build.ninja` exists and its stamp matches, and the stamp carried
only target and backend. So a tree configured once without coverage stayed
without it forever: the staticlib carried `__llvm_prf_*` counters and nothing
that writes them, and QEMU's exit produced no profile at all. The stamp now
carries `cov=$REIMS_VGPU_COVERAGE`, so turning coverage on or off reconfigures,
in both directions. The path rather than a flag, because a different clang major
is a different archive.
Verified end to end on this host: after the fixes, a driven run
(`--seconds 25 --app Safari`, 22 s of real compositing) merges 5 raw profiles
and reports **1203 of 3010 functions never ran**, with plausible per-file
coverage (`caps/api_floor.rs` 100 %, `pools/teardown.rs` 30 %,
`pools/images_and_registry.rs` 44 %). Before the fixes the same command printed
one line and exited.
No product code touched; nothing in `crates/` changes and no test count moves.