A friend and colleague of mine, Andrew Dinn, is the brains behind the brilliant Byteman project. I recently contributed a brew formula to install Byteman and all of its scripts on OS X systems - allowing a package manager to sort out installing everything in sensible locations, with upgrading and other hassles handled for you.
Install brew if you haven’t, and then run :
$ brew install byteman
If you need to, you can install the latest development version of Byteman with (e.g. ALPHA releases):
$ brew install byteman --devel
You can upgrade Byteman with :
$ brew upgrade byteman
You should now have all of the Byteman wrappers and binaries available on your path!
$ bmjava -version
If you’re not familiar with Byteman, it’s an incredibly powerful byecode manipulation utility for testing, monitoring and tracing. It can be invoked via scripts or API.
It’s particularly useful for tracking down difficult-to-reproduce concurrency bugs, as you can use it to precisely orchestrate thread orderings (interleavings, etc), wait periods, inject faults etc. There are also some cool up-and-coming projects using it to dynamically inject tracing and monitoring into existing code.