Sometimes I have an idea and then just wish I hadn't

Oct 06, 2011 19:13


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... )

Leave a comment

Comments 5

Brilliant idea. antifuchs October 6 2011, 20:50:09 UTC
I think I could use something like this for when I have to debug interaction between various versions of Motif and the X server (and of course, our library on top of Motif). Also, thanks for pointing out xtruss, which I will install ASAP and use to try and figure out a couple of nasty bugs myself.

Reply


gerald_duck October 7 2011, 00:16:31 UTC
Google can't trivially find a program called "subterfuge"; do you happen to have a link for it?

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

simont October 7 2011, 06:28:44 UTC
Subterfugue, I said. Here.

It does look pretty bit-rotted, though. "Supports Linux 2.4".

Reply


Code that writes code that writes code ext_822605 October 7 2011, 14:11:10 UTC
It's an interesting idea to write something that works at the IPC level like that.
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


ext_826143 October 10 2011, 06:35:11 UTC
As if you don't know this already:

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

Up