Quick Linux Tip #71:
Question: My binary calls a function - which library actually provides it?
Try: ltrace -e 'malloc+free' ls /tmp 2>&1 | head -20
Info: ltrace tracks dynamic library calls, similar to how strace tracks system calls. The -e option filters specific functions, showing arguments, return values, and dynamic library interactions.
Examples:
- $
ltrace -c ./program# Generate a summary report of library calls - $
ltrace -e '*@libssl.so.3' curl https://example.com# Filter functions from a specific library - $
ltrace -S ./program# Trace both library calls and system calls
Note: Install via sudo apt install ltrace. Programs run significantly slower while being traced. ltrace is useful for debugging memory-related behavior, examining dynamic library calls, and understanding shared library interactions.
Leave a Reply