SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
710 stars 109 forks source link

Are there any ways to set Kcov that scan only specified .so file or library? #394

Closed sampad1370 closed 1 year ago

sampad1370 commented 1 year ago

Hello

Thanks for good tools and I think it's very useful.

I want to only kcov scan my library and skip others, how?

Thanks.

SimonKagstrom commented 1 year ago

An easy way, but not directly tied to shared libraries, is to filter for patterns or paths for source files.

E.g., if two libraries are in

projects/graphics and work/network

You can invoke kcov with --include-pattern=graphics,network

To filter out source files with this pattern in the file name. --include-path can be used if you want an exact path to include. Similarly --exclude-pattern is also possible.

sampad1370 commented 1 year ago

Thanks for quick answering. I need to filter some .so files, similar to --skip-solibs because I think it takes a lot of time to scan my app. How can do such work?

SimonKagstrom commented 1 year ago

Just using --include-pattern etc should improve time a lot, since less breakpoints are set.

There is no way to skip specific libraries like that. The idea is that the same source file can be compiled in many libraries, and should be covered by all of them.

sampad1370 commented 1 year ago

@SimonKagstrom Thank you, I got it. I appreciate for your describing in details, and I fixed my problem with using your suggestion to use --include-pattern.