andy bennett |
Fri 2011-10-07 14:11 |
|
Code that writes code that writes code 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 |
|