Ltrace


ltrace is a debugging utility in Linux, used to display the calls a userspace application makes to shared libraries. It does this by hooking into the dynamic loading system, allowing it to insert shims which display the parameters which the applications uses when making the call, and the return value which the library call reports. ltrace can also trace Linux system calls. Because it uses the dynamic library hooking mechanism, ltrace cannot trace calls to libraries which are statically linked directly to the target binary. Since 0.7.3, ltrace can also trace calls to libraries which are loaded using dlopen.

Example output

The following is the first few lines of an invocation of xterm. It shows ltrace displaying calls to a variety of libraries, including the C standard library, POSIX libraries, X Toolkit Intrinsics, and the X11 inter-client communication library. A call's return value is shown after the = symbol.

__libc_start_main = 1000
getegid = 1000
getuid = 1000
getgid = 1000
setuid = 0
malloc = 0x00cf8010
XtSetLanguageProc = 0x7f968bc16220
ioctl = 0
XtSetErrorHandler = 0
XtOpenApplication = 0xd219a0
IceAddConnectionWatch = 1
XtSetErrorHandler = 0
XtGetApplicationResources = 0
strlen = 3