Many Unix programmers will be familiar with the utility variously called strace, truss, ktrace, dtrace and probably other names too, which logs all communication between a process and the kernel across the system call interface.
A couple of years ago I wrote an analogous program called xtruss, which produces similar logging but operates at the
(
Read more... )
Comments 5
Reply
Just last week I wanted something that could compel a specific program to use a TCP port other than the one it had hardwired, though I'd been intending to do that at the LD_PRELOAD level.
Reply
It does look pretty bit-rotted, though. "Supports Linux 2.4".
Reply
I once wrote something that you pass something like a Linux .so shared object and it'll write you a shim for it with the same signatures. This shim just calls the original symbols and passes through the arguments. It can then be LD_PRELOADed in front of the actual library.
Once I got that far it was easy to make the shim do arbitrary things with the calls such as API logging. What's even more interesting is that once you have that API log you can compile *that* and use it to replay the calls. This is really useful when trying to debug behaviour on, say, a production system without debugging symbols: you can capture your log and take it off for compilation on your testing systems.
Regards,
@ndy
Reply
Write the one-off utility, because there's guaranteed to be other people who want to do the same as you. And they might even send patches :)
Reply
Leave a comment