Adi
Adi

Reputation: 1639

how do i use strace to know about system calls in my C program

I'd like to know how to use strace to trace system calls in my C program and how to use it for debugging my code.

Upvotes: 2

Views: 8686

Answers (3)

ThiefMaster
ThiefMaster

Reputation: 318498

By running your program through strace:

strace path/to/your/executable

e.g. strace ./myapp

Upvotes: 8

user50049
user50049

Reputation:

Strace is great to see system calls. Once you understand how it works, be sure to check out ltrace as well, which shows calls to dynamically linked libraries.

Together, they give you a very good understanding of what any given program is doing (unless statically linked, of course).

Upvotes: 0

Arkku
Arkku

Reputation: 42129

Run strace [arguments to strace] your_program [arguments to your program]. See man strace or just strace without arguments for the possible arguments.

Upvotes: 4

Related Questions