Simple instrumentation for instruction counting made on c++ to be used with dynamorio.
The instructions tool was made with the tutoring and help of Andrei Rimsa. Andrei is my professor and thesis tutor from CEFET-MG.
git clone https://github.com/DynamoRIO/dynamorio.git
cd dynamorio
DYNAMORIO_HOME=$(pwd);
# go into the correct folder
cd api/samples
# clone to the here
git clone https://github.com/afa7789/dynamorio_instruction_count.git dynamo_tool
# extract it
cp ./{dyn.patch,bbl_count.cpp} .
# Add line to CMakeLists
patch < dyn.patch
make sure you have set DYNAMORIO_HOME env var at the root of the dynamorio folder.
cd $DYNAMORIO_HOME
mkdir build && cd build
cmake -DBUILD_DOCS=no ..
make -j
cd build
make bbl_count
Commands to run this code
$DYNAMORIO_HOME/bin64/drrun -c bin/libbbl_count.so -- ls
# how to use to get the output to a file.
$DYNAMORIO_HOME/bin64/drrun -c bin/libbbl_count.so arquivo_test.txt -- ls
# Example on how to run it with a full path
# By doing like this you can from anywhere in your computer
$DYNAMORIO_HOME/build/bin64/drrun -c /home/afa/Documents/code/TCC/dynamorio/dynamorio/build/api/samples/../bin/libbbl_count.so -- ls