The strace debugging tool is used to track system calls during process execution and received signals, including parameters, return values, and execution time. In Linux, to access system devices, user programs must switch from user mode to kernel mode, which is initiated and completed through system calls. Commonly used strace... strace debugging tool strace is used to track system calls during process execution and received signals, including parameters, return values, and execution time. In Linux, to access system devices, user programs must switch from user mode to kernel mode, which is initiated and completed through system calls. Common strace parameters:-c collects statistics on the execution time, number of calls, and number of errors of each system call, and reports when the program exits-p pid tracks the specified process, multiple-p can be used to track multiple processes at the same time-o filename strace is output to stdout by default, -o can write the output to the specified file.-f tracks the system calls of the sub-processes generated by fork.-ff is often used with the-o option. different processes (sub-processes) the generated system call is output to each filename. in the pid file,-F tries to trace vfork sub-process system calls. Note: When used together with-f, vfork is not tracked.-e expr outputs a filter expression, you can filter out strace results that you do not want to output-e trace = set system call in the specified trace set-e trace = network trace all system calls related to the network-e strace = signal trace all and system call related to system signal-e trace = ipc tracks all system calls related to process communication-e signal = set specifies the signal in the trace set-e read = set output from the specified file read data, for example,-e read = 3, 5-e write = set output writes data to the specified file, for example,-e write = 1-r prints the relative time of each system call-t adds time information before each row in the output-tt adds time information before each row in the output, the time is accurate to microsecond-ttt adds time information before each line in the output, and the output is relative time-s, specifying the length of each line of output string (32 by default) strace example: 1 strace-t ls # trace ls executable programs, execution time 1 strace-o output.txt-f-T-tt-e trace = all-p 8979 # trace all system calls of process 8979 and its sub-processes
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.