strace is a useful gadget – most Linux systems have been installed by default – you can track system calls to let you know what a program is doing in the background. Strace is a basic debugging tool; but it's great software even if you're not tracking a problem. It can tell you a lot about how a Linux program works.
A system call is a message from the application to the kernel. User programs in modern computer systems run in a sandbox: they don't allow direct interaction with the computer (so you can't stuff some data into registers to do some work as before). Instead, whenever a program needs to interact with the system, it sends a request (system call) to the kernel. Strace is used to track these messages. So keep in mind that if you don't see any strace output for a while, that doesn't mean your program is blocking. It's very likely that the program does something in its own sandbox, and these things don't need to communicate with the rest of the system.
Usage
Strace programs can do these things, but it always outputs everything directly to the standard error file (that is, the screen). As you will see, it produces a lot of output; so usually you'd better set an output file with the -o option:
strace -o outputfile.txt program has some editors (eg vim) can syntax highlight the output of strace. This means that different parts of the file, as well as different parts of each line, are displayed in different colors. This feature is quite useful, and I highly recommend using an editor like this to view the output of strace.
Command output explanation
Try strace -o strace.out ls –l, then open strace.out with your favorite editor and enable syntax highlighting.
Before diving into the details, let's take a look at the basic structure of each line. Strace records every system call made by the program and is displayed on a separate line. The name of the system call appears at the beginning of each line, the parameters appear in parentheses, and the return value is after the equal sign, which is the end of a line. The first few lines of the command ls –l are basically the following:
execve("/bin/ls", ["ls", "-l"], [/* 21 Vars */]) = 0 brk(0) = 0x619000 mmap(NULL, 4096, PROT_READ
One serial port control Usually we use direct serial port for video server, video recorder, switcher
The YUV format has two broad categories: planar and packed. For the planar YUV format, the Y of all
under RedHat Enterprise Linux server 5.4 First, system environment operating system: RedHat Enterp
First time when the basic network configuration is 1. Check the network mac address first[root@cento
How to copy LINUX user information
Nagios latest version installation under CentOS5.5
3 ways to quickly experience the Linux operating system
Orphan Process Group and Terminal Session Overview
Linux sed command learning experience
X capacitor Y capacitor differential mode signal common mode signal
Linux network can not start to solve
Cygwin supports Chinese configuration
How does Win8 IE speed up page loading? Turn on caching and database to speed up webpage speed
Understand the role of subnet mask in all aspects
Win7 always prompts free upgrade win10 how to do cancel the upgrade prompt method
Win7 open PDF file will prompt the number out of the border how to do?
Modify the registry to speed up the Win7 system startup speed
Why is the win8 system boot faster than win7?
Get a virtual drive in 1 minute
New changes, WP users can take the lead in using Microsoft's own application