I have been using CoreSight PTM component on Zynq for more than two years. I started out by programming a simple library to program these components on a “bare-metal” system (without OS). Then, I moved on Linux and Mathieu Poirier (I can’t thank him enough) helped me a lot during this phase. So far, I have been tracing small portions of my applications and the amount of trace generated was not that important. I was getting the expected trace i.e. for each branch (direct or indirect), I was getting a branch address packet in my trace. Now, I started tracing the whole .text section of binaries and I am not understanding the obtained trace.
Here is how I configure Linux kernel driver (Kernel v4.9):
cd
      /sys/bus/coresight/devices/f889c000.ptm0 
      echo 1 > addr_idx 
      echo 0 > addr_acctype 
      echo 0 > addr_idx 
      echo 0 > addr_acctype 
      echo 20 > mode 
      echo 100e0 104b4 > addr_range # These two addresses represent
      the beginning and end of .text section 
Then, I enable the trace sink component (either ETB or TPIU) and trace source (PTM) component.
cd
      /sys/bus/coresight/devices/ 
      echo 1 > f8801000.etb/enable_sink 
      echo 1 > f889c000.ptm0/enable_source 
Then, I run my application and stop tracing.
./application.elf 
      ./disable # simply writes 0 to each enabled component (source and
      sink) 
Then, I recover the trace using dd.
When I trace small portions of my application, the obtained trace gives the right behavior. I check it manually by looking at objdump of the binary.
However, when I trace the whole .text section of the application, the amount of obtained trace is very small (even smaller than if I trace only main function of the application) which is quite strange for me. Basically, the obtained trace is going through libc functions that call the main function and it stops while it is in libc. I don’t understand why I am getting this strange behavior. Do you have any ideas about what I am doing wrong.I have attached a binary source code that I am trying to trace. Thank you for your help and time. Best regards, Muhammad PS: Sorry, I formatted my previous mail in markdown rather than HTML. This should be more readable than the previous mail.