Strace is commonly used to track system calls and received signals when a process executes. not only can you debug a newly started program, you can also debug a program that is already running (bind the strace to an existing PID).
General Syntax:
Strace-o output.txt-t-tt-e trace=all-p 28979
The above meaning is to trace all system calls (-e Trace=all) of the 28979 process, and to count the time spent on the system call, as well as the start time (and display in the visual hour-in-seconds format), and finally the recorded result exists in the Output.txt file.
[Email protected]:/usr# strace cat /dev/ execve (, [, ], []) =  BRK () = access (,  F_OK) = - ENOENT (no such file or directory) mmap (null, , prot_read| prot_write, map_private| map_anonymous, -, ) = access (,  R_OK) = - ENOENT (no such file or directory) BRK () = brk () = fstat ( , {st_mode=s_ifchr|, st_rdev=makedev (, ),  , ...}) = open (, o_rdonly) = fstat (, {st_mode=s_ifchr|, st_rdev=makedev (, ), &NBSP, ...}) = read (, , ) = close () = close () = close () = exit_group () = ?
Each row is a system call, the left side of the equals sign is the function name of the system call and its arguments, and to the right is the return value of the call.
Strace Displays the parameters of these calls and returns the values in the form of symbols. Strace receives information from the kernel and does not need to build the kernel in any particular way.
starce LDD on an executable file, it tells you which dynamic library The program uses and where to find the dynamic library. However, LDD does not list all the dynamic libraries that the program relies on.
strace tracker can output the point in time that the system call was executed and the duration of each call, and the Pstack tool outputs the function call stack for the process that specifies the PID.
Strace + Pstack + ldd
Linux Debugging Tools Strace LDD Pstack