BinaryCoverage is a code coverage tool built as a plugin for Intel Pin, a dynamic binary instrumentation (DBI) framework. It analyzes binary executables to measure and report code coverage.
- GNU/Linux (x86_64 only)
To build and run this tool, you'll need:
- x86_64 CPU (other architectures are not supported)
make- Go language compiler
g++version 15 (or any c++ 2017 )- Catch2 v2 library (optional, only for running the C++ test suite)
- A copy is provided in
tests/catch2/catch.hpp
- A copy is provided in
Clone the repository:
git clone git@github.com:ilmanzo/BinaryCoverage.git
cd BinaryCoverage/Download and build the project:
./build.shbuild.sh will:
- Download and extract Intel Pin locally
- Build the coverage tool
- Compile and instrument the example C program in the
example/directory
Before building, export the PIN_ROOT environment variable:
export PIN_ROOT=../pin-external-4.0-99633-g5ca9893f2-gcc-linuxPIN_ROOT should point to the root directory where Intel Pin was extracted.
This is a common convention when building Pin tools.
To run the tool:
$PIN_ROOT/pin -t ./obj-intel64/FuncTracer.so -- <target_binary_path> <args...>Replace <target_binary_path> and <args...> with your target program and
its arguments.
This tool relies on DWARF debugging information to determine line-level coverage. Please compile your target programs with:
gcc -g -gdwarf-4 main.cPin 3+ supports DWARF4. Debug info is essential for accurate line mapping.
To run the unit tests:
Ensure to have gcc installed (required for running Go unit tests)
./run_unit_tests.shUses Catch2 v2 (already included in the repo in tests/catch2/catch.hpp).
If you just want to modify the HTML report templates, you don't need to rebuild everything.
HTML templates are located in cmd/templates/. You can modify them and
preview the results by displaying the HTML in a browser.
If you change the analyzer logic or Go code:
cd cmd
go build
./cmd report ../example/sample_data /tmpThis generates example HTML reports (with dummy data) under /tmp.