Skip to content

qixin5/debcov

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debcov

Debcov is a coverage-based debloating tool. It accepts as input a program and a set of coverage files (in gcov format that shows what code is covered during execution). As output, it produces a reduced program with all the code that is not covered eliminated.

Requirements

  • CMake >= 3.11
  • Clang and LibClang >= 7.0
  • spdlog >= 1.3.1
  • ROPgadget >= 5.8

Installation

Make sure you have installed all the required libraries (shown above).

Linux

Once you have all the requirements, do the following steps.

  1. Run ./compile_java.
  2. In CMakeLists.txt, change to your own paths the last two include_directories (lines ending with "Change to your own path!").
  3. Run cd build.
  4. Run cmake ...
  5. Run make.

Usage

DEBCOV_BIN SOURCE_FILE COVERAGE_FILE/DIR

DEBCOV_BIN: The debcov binary (bin/debcov). NOTE: If you haven't done so, change DEBCOVDIR to your own path in this file. SOURCE_FILE: The program source file. COVERAGE_FILE/DIR: A coverage file (or a directory) generated by gcov (with the -i option). Please refer to https://gcc.gnu.org/onlinedocs/gcc/Gcov.html for more information.

Example

  1. cd test
  2. ../bin/debcov mkdir-5.2.1.c mkdir-5.2.1.c.gcov

mkdir-5.2.1.c.gcov contains the coverage information derived from running the program instrumented against two inputs: (1) dir and (2) -p foo/bar. What's generated as a result is a file named mkdir-5.2.1.reduced.c. Now compile the resulting program by running gcc -w -o mkdir-5.2.1.reduced mkdir-5.2.1.reduced.c and see if it can produce the correct outputs for the two inputs.

To generate mkdir-5.2.1.c.gcov, try the following.

  1. ./clean.sh
  2. gcc -w -fprofile-arcs -ftest-coverage -o mkdir-5.2.1 mkdir-5.2.1.c
  3. ./mkdir-5.2.1 dir
  4. ./mkdir-5.2.1 -p foo/bar
  5. gcov -i mkdir-5.2.1.c

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published