This is a implementation of trace IntelPT using perf.
You should run this code on Linux desktop, NOT virtual environment ( except Hyper-V in Windows, check this link Enable Intel Performance Monitoring Hardware in a Hyper-V virtual machine ).
Tools
sudo apt install cmake g++ makelibipt v2.1 ( for decoding )
-
optional : If you want to use tools in libipt ptdump, ptxed and other things, you should modify CMakeLists.txt in libipt before run
cmake.ex)
option(PTDUMP "Enable ptdump, a packet dumper")->option(PTDUMP "Enable ptdump, a packet dumper" ON)
git clone https://github.com/intel/libipt.git -b v2.1
cd libipt
mkdir build && cd build
cmake ..
make
sudo make installMake sure libipt is installed.
git clone https://github.com/lcy8047/ProcessorTracer
cd ProcessorTracer
mkdir build && cd build
cmake ..
makesudo ./bin/trace_test <executable file>Then, you can get files traced_data.bin and maps_data.
Also, you can dump traced_data.bin with ptdump in libipt.
./ptdump traced_data.binDecoding traced data file will be implemented.