ltrace
ltrace is a debugging tool that traces library function calls made by a program, showing which shared library functions are invoked and their arguments and return values.
ltrace works similarly to strace, but instead of tracing system calls, it intercepts and logs calls to dynamic library functions (functions in shared libraries like libc). This helps developers understand how their program interacts with external libraries.
When you run ltrace ./myprogram, the tool displays each library function call in real-time, including the function name, arguments passed to it, and the return value. For example: strlen("hello") = 5.
Common use cases include debugging library-related issues, understanding third-party library behavior, and performance analysis. You can filter output with options like -e to trace specific functions: ltrace -e malloc,free ./myprogram traces only memory allocation calls.