Linux command Debugging Tools strace In-depth Analysis _php example
Source: Internet
Author: User
Reference 1 "Linux strace Command (detailed). txt" Sina ebook can download
2man Strace
A complete usage that is basically universal: strace-o output.txt-t-tt-e trace=all-p 28979
The above meaning is to track all system calls (-e Trace=all) of the 28979 process, and to count the time spent by the system call, as well as the start time (and display in the visual minutes), and finally the record result exists in the Output.txt file.
Several usages that must be remembered 1) strace-p PID can track a background process
2) strace-o filename to output the trace results to the file
3) Strace-t records the time spent on each system call to see which system is called for a long time
4) Strace-t (or-TT) records the time that each system call takes place (in the form of minutes and seconds)
5) Strace-s 1024 shows the system call parameters, the length of the string display, the default is 32, if the string parameters are very long, a lot of information can not be displayed.
6) Strace-e Trace=nanosleep only records the relevant system call information.
-e trace=network//logging and network API-related system calls
-e Trace=file//records only system calls involving file names
-e Trace=desc//records only system calls involving file handles
There are other, including process,ipc,signal and so on.
A classic, through the Strace view a process of all relevant open files of the process, refer to the "Linux strace Command (detailed) txt" sina ebook can download
If the development program does not have a powerful tool to accompany, then the development efficiency will be very low, even encountered problems can not be. Now start learning the powerful debugging tools Strace under Linux and record this.
Strace 1) similar to Windows Processexp.exe can monitor system calls
2 Similar to the Depand tool under Windows You can check your program's dependent libraries. More powerful than the LDD under Linux.
Reference: Strace command usage
Click to download Case: Strace helps me solve the problem where the log files are printed.
Tracking server with Strace
/usr/bin/strace-p Pid-o Out.file
Then execute the client side, then end strace, and view the system call to Out.file search Write,open
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.