Hi, Today I’m introducing the Peekaboo Tracer available at GitHub. You can use it to obtain the sequence of instructions executed while running a program or function as a trace. A trace in general, is a sequence of events happened when performing a task. So, if any errors were occurred while performing the task, the trace can be analyzed to find the problem or the cause. Hence, the objective of Peekaboo is to help the users generate the traces.
Challenges in Tracing
The typical challenges in generating and managing a trace:
- Length of the trace is tool long: If a single trace file includes all the attributes of a instruction, then the file size becomes too big.
- Customized requirements: which attributes of the instructions are included in the trace (An instruction includes an instruction address, opcode, register value, memory value, memory address): If a single trace includes selected attributes for each instruction. Then reading the trace becomes difficult.
Solution by Peekaboo
In addressing the above challenges, Peekaboo introduces modularization. In precise, it generates a file for each attribute in a instruction such that each attribute file includes a sequence of attributes corresponding to the sequence of instructions executed. Hence, depending on the interest of the user, he can generates the trace including selected attributes.
Set up Peekaboo
Peekaboo is built on top of DynamoRIO instrumentation tool. Hence, we required to download the latest build of DynamoRIO to test the Peekaboo.
- Download DynamoRIO DynamoRIO-Linux-7.91.18319.tar.gz
- Download Peekaboo Source: git clone https://github.com/melynx/peekaboo.git
Next, following the guide in the Peekaboo documentation..
cd peekaboo_dr mkdir build cd build DynamoRIO_DIR=/path/to/DynamoRIO/DynamoRIO-Linux-7.91.18319 cmake .. make
Generate the trace for executing ls command as follows.
path/to/DynamoRIO/DynamoRIO-Linux-7.91.18319/bin64/drrun -c /path/to/peekaboo/peekaboo_dr/build/libpeekaboo_dr.so -- ls
Results: Generated Trace Files
Cheers ! 🙂