xtrace is a tracing utility similar to truss and strace. It produces a trace of system or arbitrary function calls made by the specified process. Each line of a trace output shows either a system or a user function call details with arguments and return values. It has a few unique features, that does not provided by the other utilities. That features are:
- function trace (dynamically or statically linked)
- timestamp dump (allows a quick profiling)
- backtrace dump (analogue of gdb's `bt' command)
- per-thread information dump (not implemented yet)
How it works ?
The xtrace behaves similarly to any other utility, when the syscall trace requested. When the function trace requested, it behaves like gdb. Fist, xtrace scans the executable and all dependant libraries, and gets the list of functions from the ELF headers. Then, it puts the breakpoint instruction on the first instruction of specified functions. Therefore, it is possible to set the breakpoint on every function listed in the executable or dependant libraries. It is possible to set a breakpoint on all functions called by the executable. This gives a possibility to look under the hood - for example, see the functions that are called by the dynamic linker.
- FreeBSD 4.x
- Linux 2.x.x
Working on support:
- Solaris 2.6 +
The xtrace project is hosted on
xtrace is written by Sergey Lyubka