By sundararajan on Aug 08, 2008
One of the issues reported with BTrace is that the trace authors have to write "verbose" code [some people say Java is "verbose"!]. In BTrace, we have to repeat the same set of imports, annotations in every btrace file and all methods have to be "public static void" and so on. Instead of inventing a new scripting language, I've added a simple C preprocessor like step in BTrace compilation. This preprocessor is based on the one in the GlueGen project. Thanks to Ken Russell for this code and for reviewing my changes specific to BTrace project. The preprocessor solution does not rule out a scripting solution in future If you have nice ideas or would like contribute in this area, you are always welcome! But, I think preprocessor solution is simple and will be useful to some.
To run this sample, the following command can be used:
Simple Example: btracedefs.h ThreadBean.java
Without the -I option in command line, BTrace skips the preprocessor step.
btrace -I . <pid-of-the-traced-process> ThreadBean.java