Ltrace: library call tracer
intercept and record the dynamic calls made to shared libraries.
Use Ltrace to find program bugs
ltrace ./program
OR
ltrace -p process_id
https://www.go4expert.com/articles/ltrace-linux-debugging-utility-tutorial-t29095/
a) check version of ltrace
ltrace --v
b) redirecting output to a file
ltrace -o fibonacci.log ./fibonacci 20
c) trace selected library calls, use -e command. eg. Trace malloc and free functions but to omit those that are done by the libc library, use:
ltrace -e malloc+free-@libc.so* program
eg. ltrace -e opendir+readdir+closedir ls
d) display timestamp
ltrace -t program [argument...]
ltrace -tt program [argument...]
e) display each line of the trace with time required to execute the respective system call, use -r command line. eg.
ltrace -r program [argument...]
f) use -c command line to display how many time were these system calls or library calls executed?
ltrace -c program [argument...]
Strace: to intercept and record system calls and the signals received by a process.
using strace to analyze how a program interacts with the system when source code is not available.
Ltrace: library call tracer intercept and record the dynamic calls made to shared libraries.
Strace: to intercept and record system calls and the signals received by a process. using strace to analyze how a program interacts with the system when source code is not available.