Coverage - Missed at these PC offsets - Warnings

Coverage - Missed at these PC offsets - Warnings

What This Warning Means

During code coverage analysis, SWI-Prolog’s coverage tool attempts to map which parts of your code were executed. For predicates that were executed but have internal branches that weren’t fully exercised, the tool generates a warning like:


Warning: Failed to report call sites for abc_persist:assert_abc_fact_xyz/3
Missed at these PC offsets: [6,11,16,17,33]

The “PC offsets” (Program Counter offsets) are internal virtual machine (VM) bytecode addresses within the compiled predicate that the coverage tool couldn’t map back to source code lines.

Why It Happens

SWI-Prolog compiles Prolog code to bytecode before execution. The coverage tool:

  1. Instruments the bytecode to track execution
  2. Records which bytecode addresses (PC offsets) were reached
  3. Maps those addresses back to source code lines for the report

For some predicates—particularly those generated dynamically or with complex control flow—the coverage tool cannot reliably map internal VM addresses back to source code locations. This is a limitation of the bytecode-to-source mapping, not a problem with your code.

Why You Can Ignore This Warning

  • Your code is working correctly — the predicate executed and completed successfully
  • The predicate has coverage — it was called and ran; we just can’t pinpoint every internal branch
  • These offsets cannot be improved — they’re internal to how SWI-Prolog’s bytecode optimizer works; you cannot “fix” them in source code
  • This affects only the detail level of reports — coverage summaries (% covered) are still accurate

Example: Why Some Predicates Show This

Predicates like assert_abc_* in abc_persist.pl use library(persistency) to wrap calls around a persistent database. The coverage tool cannot fully instrument this dynamic code path, so it reports unmappable offsets even though the predicate executed correctly.

What The Coverage Report Still Shows

  • :white_check_mark: The predicate was executed (shown in coverage summary)

  • :white_check_mark: Overall coverage percentage is still accurate

  • :white_check_mark: Source lines that executed are still annotated

  • :cross_mark: We cannot pinpoint every internal control-flow branch (the unmappable offsets)

Recommendation

Treat these warnings as informational noise. They indicate:

  • Your code runs ✓
  • The tool has confidence limits on detail ✓
  • You should focus on code correctness via tests, not on fixing unmappable offsets ✓