You can use uftrace utility written by Namhyung
Kim. It's available as a package
in Ubuntu although I built
the code from master branch manually to make sure I use the newest
vanilla version. Example main.c
:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts("Hello World");
return EXIT_SUCCESS;
}
Build with -z now
:
gcc -O2 main.c -z now -o main
ltrace
doesn't work:
$ ltrace ./main
Hello World
+++ exited (status 0) +++
But uftrace
does:
$ LD_LIBRARY_PATH=~/uftrace/libmcount ~/uftrace/uftrace -a --force ./main
Hello World
# DURATION TID FUNCTION
58.231 us [ 16283] | puts("Hello World") = 12;
See this thread on project's site on Github: tracing library calls
even if it has no PLT #592.