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

Segfault on a haskell binary with DWARF and linked with --gc-sections #388

Open jberryman opened 1 year ago

jberryman commented 1 year ago

See https://github.com/google/bloaty/issues/329 which has an example.

This seems likely a problem with the binary, but thought I would open a ticket, as maybe you'd want a conditional check like bloaty is doing.

kcov /tmp/kcov3 /tmp/pandoc/dist-newstyle/build/x86_64-linux/ghc-9.2.5/pandoc-3.0/t/test-pandoc/build/test-pandoc/test-pandoc
kcov: Process exited with signal 11 (SIGSEGV) at 0xffffffffffffffff
SimonKagstrom commented 1 year ago

I'm investigating this a bit now, but have trouble reproducing it in a good way. I'm on a Mac, so reliant on a Docker image with Linux right now, which can't run this binary with or without kcov.

Does kcov --verify [...] help with this binary? I tried listing the breakpoint it sets, but doesn't see any obvious strange addresses (although there are lots of them, so might have missed something!)

jberryman commented 1 year ago

Hi, appreciate you looking into it!

I see:

❯ kcov --verify /tmp/kcov3 /tmp/pandoc/dist-newstyle/build/x86_64-linux/ghc-9.2.5/pandoc-3.0/t/test-pandoc/build/test-pandoc/test-pandoc
kcov: 411783 invalid breakpoints skipped in /tmp/pandoc/dist-newstyle/build/x86_64-linux/ghc-9.2.5/pandoc-3.0/t/test-pandoc/build/test-pandoc/test-pandoc
kcov: 1 invalid breakpoints skipped in /lib/x86_64-linux-gnu/libm.so.6
kcov: Process exited with signal 11 (SIGSEGV) at 0xffffffffffffffff

Let me know if thiere's something else I can help with