Linux Debugging Tools Strace LDD Pstack

Source: Internet
Author: User

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 (, ), &nbsp, ...})  = 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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.