How can I use strace to find out about system calls in my C program

I would like to learn how to use strace to track system calls in my C program and how to use it to debug my code.

+2


a source to share


3 answers


By running the program through strace:

strace path/to/your/executable

      



eg. strace ./myapp

+8


a source


Run strace [arguments to strace] your_program [arguments to your program]

. See man strace

or just strace

no arguments for possible arguments.



+4


a source


Strace is great at seeing system calls. Once you understand how this works, be sure to check out ltrace , which shows the calls to dynamically linked libraries.

Together they give you a very good idea of ​​what any given program does (unless statically linked, of course).

0


a source







All Articles