Skip to content
/ APEX Public

APEX is a tool that can extract active code path from the C program source code and recompile this path into new, standalone executable.

License

Notifications You must be signed in to change notification settings

examon/APEX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APEX - Active code Path EXtractor

APEX is a tool that can extract active code path from the C program source code and recompile this path into new, standalone executable.

Getting started

In order to run APEX, you need to have llvm installed:

If you want to build LLVM from source, run:

cd src
./build_llvm.sh

After getting LLVM, APEX needs to be built. Run the following command to build APEX:

make build

How to run APEX

First, you need to compile your C program into LLVM bitcode since APEX cannot work directly with the C source code.

clang -c -g -emit-llvm main.c -o main.bc

After obtaining bitcode, we can now run APEX via apex.py launcher:

python apex.py main.bc main.c 16

apex.py requires three arguments. See usage for full description:

usage: apex.py [-h] [--export EXPORT] code file line

positional arguments:
  code             C source code compiled into LLVM bytecode.
  file             Target file name (NOT FULL PATH).
  line             Target line number.

optional arguments:
  -h, --help       show this help message and exit
  --export EXPORT  true/false for exporting call graphs.

APEX produces extracted executable called extracted along with the build directory (containing various files, logs, etc.).

Current limitations:

Since APEX is under development, there are currently some serious limitations:

  • It is possible to extract values only from integer variables.
  • APEX can handle small programs (see examples direcotry), but may have problems with bigger ones.
  • (Probably tons more that I don't know about.)

About

APEX is a tool that can extract active code path from the C program source code and recompile this path into new, standalone executable.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published