Skip to content

An LLVM Pass that transforms any given program that contains direct calls to printf(), so that all output via printf() is also logged in a file using fprintf() right after each printf() call.

License

vangelists/LLVM-Pass-for-Printf-Call-Logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLVM Pass for printf() Call Logging

This pass was created as a project for the Type Systems and Static Analysis course and is no longer maintained.

In case you are interested, you can take a look at the project report.


Built and tested against LLVM 7.0.1 on macOS Mojave 10.14.3 and Ubuntu 18.04 LTS.


Table of Contents

Prerequisites

  • LLVM source code
  • Clang
  • CMake
  • Zsh (for executing the scripts)

Instructions

Configuring

In scripts/configuration.zsh:

  1. Point LLVM_SOURCE_DIR to the LLVM codebase.
  2. Point LLVM_BUILD_DIR to the directory LLVM should be built in.
  3. Point CLANG to the Clang executable that should be used to compile the test files.
  4. Set GENERATOR to your generator of choice, e.g. Ninja or Xcode.

Building LLVM

$ cd scripts
$ ./build_llvm.zsh

Building Pass

$ cd scripts
$ ./build_pass.zsh

Building & Running Tests

$ cd scripts
$ ./run_test.zsh

Cleaning Up

$ cd scripts
$ ./clean_up.zsh

Building & Running Everything

You can run all of the above mentioned steps at once using the following script:

$ ./build_and_run.zsh

Adding a Test

Create a test file <TEST_NAME>.cpp and place it under test. Build and run the test using either:

$ cd scripts
$ ./run_test.zsh <TEST_NAME>

or

$ ./build_and_run.zsh <TEST_NAME>

If no test name is provided, defaults to hello.

NOTE: The working directory of the test file will be logs.

Getting the Results

All logging happens in logs/log.txt.

License

Licensed under the Mozilla Public License 2.0.

Contact

Vangelis Tsiatsianas - contact@vangelists.com

About

An LLVM Pass that transforms any given program that contains direct calls to printf(), so that all output via printf() is also logged in a file using fprintf() right after each printf() call.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published