Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.86 KB

README.md

File metadata and controls

33 lines (23 loc) · 1.86 KB

Tasks for UROP in Software Reliability Group

The two tasks are in their respective directories.
Running make all inside each of task1 and task2, quickly shows results.
For task2 the required pdf will be generated inside in the directory.

The rest of the README is just info on my implementation

Task 1

malloc\_intercept.c contains a wrapper around original_malloc.
I use the <dlfcn> library to dynamically read the address of the original malloc fucntion.
The bytes allocated is tracked and printed during calls to original_malloc.

make generates malloc_intercept.so which can be used with LD_PRELOAD.
The make file uses the same program seq 1 5 as in the example.

Task 2

Inside the directory, make llvm_pass prints the number of functions and blocks, as well as generating data for gnuplot.
make plot_histogram will create Basic Blocks Histogram.pdf
The program being used can be changed by changing the Makefile variable and copying the <program>.c into the directory.

Dependencies: Clang and LLVM (with header files) and gnuplot.
I've made a shared object, which opt can use to make an analyze (no mutation) pass.
I've decided to subclass FunctionPass, with state stored in the members.

The pass is registed as info. In each function, it iterates through the basic blocks and updating a map. The map is given by x->y where there are y basic blocks with x instructions each. The total block and functions count is also getting incremented.
doFinalization is overriden to write the outputs using the information collected.

(I had tried to subclass ModulePass (but that included #includes which was problematic). It is also more granular than necessary)

Also I can share ssh access to my DoC virtual machine (which I tested everything on) given a username.