There are three steps to running this tool for checking a program for a deadlock.
- Instrument the source code.
- Compile and profile the instrumented code into an executable.
- Execute the profiled code for the output.
The detailed instructions are as follows:
To compile the clang tool, use cd clangTool && make clangTool
This requires:
- clang+llvm build files which you can download from here. I have downloaded clang+llvm-3.8.0-x86_64-linux-gnu-debian8.tar.xz. Please change the location of the libraries in Makefile in clangTool folder (this flag: CLANG_BUILD_FLAGS).
- a file called compile_commands.json which is a compilation database needed for clang tooling. The directory contains a sample compile_commands.json file. You just have to specify the command, fileName, and the directory. Learn how to create such files here.
Change the path to these directories in the Makefile of directory clangTool accordingly.
To produce the instrumented code, run: ./clangTool path-to-the-source/source-file.cpp
This will generate a file called i_source-file.cpp in the same directory where the source resides.
Follow these steps:
cd Hermes/
make
sudo make install
cd scheduler
If the make
command gives any error regarding libopts.a or solver-src.a being missing, then run make
command from these directories, i.e. from libopts and solver (probably after running make clean
). Also, make sure to add -lz3
for the LIBS
in Makefile of the Hermes
and scheduler
folders.
This should generate libisp_prof.so in /usr/local/lib/.
To generate the profiled executable, run:
ispcxx -o executable executable.cpp ../clangTool/GenerateAssumes.cpp ../clangTool/IfInfo.cpp ../profiler/Client.c
Run the executable through the tool isp with this command: ./isp.exe -n no-of-processes ./executable
You can find all the options isp provides using ./isp.exe -help