Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No coverage with "--skip-solibs" #328

Open
pfrenzel opened this issue Jun 11, 2020 · 2 comments
Open

No coverage with "--skip-solibs" #328

pfrenzel opened this issue Jun 11, 2020 · 2 comments

Comments

@pfrenzel
Copy link

I'm using kcov for C++ coverage reports.

After upgrading to Ubuntu 20.04 from 16.04 and recompiling of kcov I get zero coverage with the "--skip-solibs" flag.
I verified this with a "hello-world" program. Without this flag everything is fine but adding the flag I get zero coverage.

I also get this behavior with the ubuntu docker containers. There I used the default kcov-deb package.
Ubuntu 16.04 works but 20.04 does not. Here are my steps to reproduce. "hello" is just a hello-world.
docker run --rm -it --security-opt seccomp=unconfined -v $(pwd):/source ubuntu:16.04

$ apt-get update && apt-get install -y g++ kcov jq
$ cd /source && g++ -Wall -Wextra hello.cc -g -o hello
$ kcov --skip-solibs ./coverage hello

@SimonKagstrom
Copy link
Owner

SimonKagstrom commented Jul 15, 2020

Hmm... Sorry for the very late reply.

I personally use Fedora (still at 31), where this works as expected. Anyway, it's a bit surprising that the actual --skip-solibs flag causes the failure, since solib handling is sort of an add-on-feature. It relies on using LD_PRELOAD to load a special library to override dlopen.

Perhaps a thing to test, if you have the opportunity, could be to to run kcov with LD_PRELOAD=, if there for some reason is a library preloaded by default with ubuntu 20.04, i.e.,

LD_PRELOAD= kcov --skip-solibs [...]

@pfrenzel
Copy link
Author

pfrenzel commented Aug 4, 2020

Unfortunately resetting LD_PRELOAD has no effect.

There are no problems with Fedora in the current version. Debian sid shows the same behaviour as Ubuntu 20.04 (no lines hit).

I've attached two outputs with debug=31.
ubuntu:16.04.log
ubuntu:20.04.log

I just found out that a program compiled with ubuntu16.04 gives the correct result with kcov under 20.04.
Under 16.04 I tested with g++-9 and always got the correct result. But when I use g++-9 in 20.04 I get again that no lines were run through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants