DTrace probes -- assert() on steroids?
By rvs on Apr 29, 2007
Quite recently I've had a conversation with a good friend of mine who shares my interest in DTrace and compilers and it seems that we've come up with a pretty neat use for DTrace probes. The idea is to start using DTrace probes for assert(3). You know how, during the development cycle the assertions are kept in the code and when the final build is supposed to happen most of them get deleted by turning off a magic define? Well, with DTrace probes used instead of assert() the beauty is -- they are all turned off by default (no funky defines required) but the dynamic nature of DTrace lets you turn any subset of them on when and only when you really need them. Like at a customer site (with the production code running) to diagnose a particular problem. Neat, isn't it?