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

SIGSEGV exit when running on certain programs #299

Closed xxuejie closed 5 years ago

xxuejie commented 5 years ago

First of all, thanks for this awesome project!

While we are configuring this project for our project, we found that SIGSEGV signal(I believe that means a segfault?) would be generated for certain configurations. Here's how to reproduce this

$ git clone https://github.com/xxuejie/ckb-vm-kcov-bug
$ cd ckb-vm-kcov-bug
$ cargo build --release
$ kcov coverage target/release/ckb-vm-kcov-bug ../../ckb-vm/tests/programs/simple64
kcov: Process exited with signal 11 (SIGSEGV) at 0x555555558e5c

However if we do a debug build, this would work perfectly:

$ cargo build
$ kcov coverage target/debug/ckb-vm-kcov-bug ../../ckb-vm/tests/programs/simple64

And actually if you remove those 2 lines, do a cargo clean and cargo build --release again, kcov would work but there won't be any coverage generated cuz by default Rust doesn't generate debug infos in release build.

I'm not too familiar with kcov to tell if this is a Rust configuration problem or a kcov issue, any chance you can take a look? Many thanks!

SimonKagstrom commented 5 years ago

Hi Xuejie!

Sorry for the late response, been on vacation.

I think this is probably the same as either #212 or #82, so you should try adding --verify to the kcov command line. #82 describes a bit more about why it's needed, it seems to happen much more with Rust programs.

xxuejie commented 5 years ago

Ooops sorry for the delay, I can confirm that adding --verify works for our case, many thanks!