1

I'm trying to call llvm-cov gcov -b "$@" but getting the error: "llvm-cov gcov: for the -b option: may only occur zero or one times!" and cannot find any explanation for it... Does anybody know what it means?

context: an attempt to get code coverage with initial coverage on Ubuntu 20.04.

Having llvm-gcov.sh:

#!/bin/bash
exec llvm-cov gcov --branch-probabilities --branch-counts --unconditional-branches --all-blocks --function-summaries "$@"

In cmake file did: set(TOOLCHAIN_FLAGS_DEBUG "-g -fstandalone-debug -O0 --coverage")

Do build.

Call: lcov --initial --directory .. --gcov-tool "${REPORT_DIR}/llvm-gcov.sh" --capture -o base.info. Getting "llvm-cov gcov: for the -b option: may only occur zero or one times!". Without 'branch' options it works fine.

Run app.

Call: lcov --directory .. --gcov-tool "${REPORT_DIR}/llvm-gcov.sh" --capture -o app.info. Getting the same error.

Call: lcov -a base.info -a app.info -o total.info

Call: genhtml total.info -o out_report

Dmitrii
  • 98
  • 6
  • "Does anybody know what it means?" - It means that you call `llvm-cov` and pass it a `-b` parameter **twice** or mote. Probably, **parameters** to your `llvm-gcov.sh` script already contain `-b` option (or its equivalent `--branch-probabilities`). You could easily check that by printing that parameters. – Tsyvarev Oct 21 '22 at 12:17
  • in this case, I would be able to see info about branches inside the report, but it's not there – Dmitrii Oct 21 '22 at 12:20
  • "in this case, I would be able to see" - Why are trying to check something **indirectly** if there is a simple way for **direct** check? – Tsyvarev Oct 21 '22 at 12:24
  • sorry for the stupid question but how to print those parameters (I don't see verbose params)? Btw in the question, I pasted the content of my llvm-gcov.sh – Dmitrii Oct 21 '22 at 12:44
  • 1
    "but how to print those parameters?" - Add `echo "@$"` inside the script. "Btw in the question, I pasted the content of my llvm-gcov.sh" - But you don't show with which parameters it is **called**. As you specified your script as `--gcov-tool` option for `lcov`, then your script is called during that `lcov` call. But it is unclear which exact parameters are passed to it. – Tsyvarev Oct 21 '22 at 12:49
  • I can confirm Tsyvarev's answer. My llvm-cov-12 passed `-b` option independently – tenta4 Jun 02 '23 at 21:16

0 Answers0