Tips of tracing all the functions called in C

Hi

I am using Fedora 37. I am debugging a C program using OpenSSL API with the OpenSSL compiled with debug flags from the source on the OpenSSL download site.

$ ./Configure --prefix=$HOME/.local/openssl-3.0.8-fips-debug --libdir=lib shared linux-x86_64 enable-fips -O0 -g3 -ggdb3 -gdwarf-5
$ make -j4
$ make install

Now I want to see the called functions in the both the program and the openssl . It seems that the strace only prints the system calls, and ltrace prints the top of the functions.

$ LD_LIBRARY_PATH=/home/jaruga/.local/openssl-3.0.8-fips-debug/lib/ \
  OPENSSL_CONF=/home/jaruga/.local/openssl-3.0.8-fips-debug/ssl/openssl_fips.cnf \
  a_command ...

I found the example of using the dtrace below. This looks nice. The answer is in November 2021. It’s still new. However the dtrace -F option used in the example doesn’t exist.

$ rpm -qf /bin/dtrace
systemtap-sdt-devel-4.8-1.fc37.x86_64

So, could you recommend me a command to print the called functions nicely on Fedora? Perhaps, dtrace with different options or systemtap can be used?

Thanks!

Perhaps you are looking for something a bit more granular in debugging than a tracer. You might consider using a full on debugger like gdb instead.

1 Like

Thank you for your reply. I am using the GDB. And I see the GDB’s bt (backtrace) command is useful to see the backtrace from the problematic point to the main. But as the logic is complicated with many nested functions, I wanted to see the big picture.

By the way, for someone who is interested in the actual case, here is the issue ticket I opened to ask on the OpenSSL project.