1.strace brief introduction

strace Commonly used to track system calls and received signals when a process is executing . adopt strace You can know which files the application has opened , And what they read and wrote , Including the time consumed and the return value, etc

2. install strace command

First, you need the following two files :

Steps are as follows :

#tar -xjf strace-4.5.15.tar.bz2#cd strace-4.5.15/#patch -p1 <../strace-fix-arm-bad-syscall.patch//“p1” Value to remove the first path of the patch  “<” The location of the patch file ,“../”  Return to the previous directory #./configure --host=arm-linux  CC=arm-linux-gcc         // To configure configure#make                                                   // Generate strace Command file 

And then strace Command file , Put it in the root directory of our development board /bin in , You can use it

#cp  strace  /nfs_root/bin/          //nfs_root: Development board nfs System root 

3.strace Command to use

Common parameters are as follows :

-o Specifies the output file of the trace information
-t Time to record tracking information , With S In units of
-tt Time to record tracking information , With uS In units of

4. example

adopt strace To test led_text Applications

#insmod led.ko                   // load led drive # strace  -o log.txt  ./led_text led1 on              // test led_text Applications , open led1, And output the tracking information to log.txt in 

among log.txt The contents of are as follows :
 Insert picture description here