I’m on an Ubuntu x86_64 system. I know we have the strace command to trace the system calls in our programs. However I’d like to know if there is a way ( other than inspecting the GNU C library source codes ) to get the complete function calls chain.
For example when I do :
printf("Hello Worldn");
I’d like to know the complete function call chain from printf all the way down to the write system call ( not the wrapper function )
2
Answers
Debugger is for that. Example debugging
echo
program:You could use bcc’s
stackcount
to do this. It relies on eBPF to aggregate stack traces in the kernel. To trace the write(2) syscall for your process, you can run:On Ubuntu, you can install it with
apt install bpfcc-tools
. See https://github.com/iovisor/bcc/ for more details.