7.6. Using ltrace and strace Utilities

The ltrace program is a tracing utility for library function calls. It runs a program and logs all library function calls by that program. You can also use this utility to log system calls made by a program. The utility can also monitor child processes created by fork() or clone() system calls. This utility is very useful to quickly trace the failure point of an executable program. The utility may also print the time at which a particular function call or system call is executed with a resolution of microseconds.

Consider the simple single-line program that prints the string “Hello world” and then exits. Using ltrace with the executable of this program produces the following result.

 [root@boota ltrace]# ...

Get Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.