The ltrace and strace commands are useful, but it would be really nice to trace both user-space and system-space function calls. The -S option to ltrace will do this. The next example shows the ltrace -S output from the previous executable:
$> ltrace -S ./a.out SYS_brk(NULL) = 0xa9f000 SYS_mmap(0, 4096, 3, 34, 0xffffffff) = 0x7fcdce4ce000 SYS_access(0x3b0dc1d380, 4, 0x3b0dc00158, 0, 0) = -2 SYS_open("/etc/ld.so.cache", 0, 01) = 4 SYS_fstat(4, 0x7ffd70342bc0, 0x7ffd70342bc0, 0, 0xfefefefefefefeff) = 0 SYS_mmap(0, 95195, 1, 2, 4) = 0x7fcdce4b6000 SYS_close(4) = 0 SYS_open("/lib64/libc.so.6", 0, 00) = 4 SYS_read(4, "\177ELF\002\001\001\003", 832) = 832 SYS_fstat(4, 0x7ffd70342c20, 0x7ffd70342c20, 4, 0x7fcdce4ce640) = 0 SYS_mmap(0x3b0e000000, ...