crytic / medusa

Parallelized, coverage-guided, mutational Solidity smart contract fuzzing, powered by go-ethereum
https://secure-contracts.com/program-analysis/medusa/docs/src/
GNU Affero General Public License v3.0
300 stars 40 forks source link

add LCOV as an output format for coverage #418

Closed 0xalpharush closed 1 month ago

0xalpharush commented 2 months ago

https://github.com/jandelgado/gcov2lcov/blob/master/main.go

see spec (https://github.com/linux-test-project/lcov/blob/07a1127c2b4390abf4a516e9763fb28a956a9ce4/man/geninfo.1#L989)

What we need:

SF:<path to the source file>
FN:<line number of function start>,[<line number of function end>,]<function name>
DA:<line number>,<execution count>[,<checksum>] # for now, we will only put 0 or 1 for execution count and we can ignore checksum
LH:<number of lines with a non\-zero execution count>
LF:<number of instrumented lines>
end_of_record

Our number of instrumented lines should be the active line count and our non-zero should only considered IsCovered (ignoring reverts for now TBD how to represent this in future) https://github.com/crytic/medusa/blob/54532f14538febce51a88f727ab048cc347522ab/fuzzing/coverage/source_analysis.go#L233-L237