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
712 stars 109 forks source link

Hangs on macOS #356

Closed Jarred-Sumner closed 2 years ago

Jarred-Sumner commented 3 years ago

I compiled kcov from HEAD (and before that, tried the homebrew version), and when I try to run it, it hangs.

Also, I'm unable to use CTRL + C to kill the process. I have to kill the process manually. This happens whether or not the program crashes or returns a 0 exit code.

Note that this does not seem to happen when using built-in commands such as /bin/ls -- in that case, CTRL + C exits the process.

This is the particular command I ran:

kcov ./cover ./build/debug/macos-x86_64/esdev -- --help

./build/debug/macos-x86_64/esdev is a compiled binary written in Zig (which was compiled with LLVM 12).

There are files generated in ./cover, so it doesn't appear to be a permissions issue.

Do you have any ideas of what else to try?

SimonKagstrom commented 3 years ago

Strange.

One thing you could try is to limit the code to set breakpoints in, to see if it's a scalability issue, e.g.,

kcov --include-pattern=file.extension ./cover ./build/debug/macos-x86_64/esdev -- --help

You perhaps already saw #278, although that is for crashing processes. There was a similar issue with rust as well, #319, but I think that was caused by more external issues.

judofyr commented 2 years ago

In case anyone else is struggling with this: The reason it was slow for me was because it was instrumenting the actual Zig standard library. I changed it to use kcov --include-path . … and then it became much faster.

SimonKagstrom commented 2 years ago

Yes, unfortunately instrumentation on OSX is quite slow, so limiting the scope of the instrumented code with --include-pattern or --path often helps enormously. It's still very slow compared to Linux, but at least things improve that way.

Closing the issue, at least I hope it's not a generic hanging problem but more of a performance issue.