BTrace Developer's Guide

BTrace is a safe, dynamic tracing tool for Java. Please refer to user's guide for BTrace usage information.

BTrace Development Tools

BTrace Components

BTrace accepts a tracing program written in (subset) of the Java programming language. BTrace compiles the trace class into bytecode and submits the same to a java.lang.instrument agent that runs inside the target program. The BTrace agent is dynamically loaded into the target program if it is not already loaded (using "attach-on-demand" API).

BTrace Components:

BTrace Packages

BTrace jar files

BTrace "To Do"s

Debugging BTrace

BTrace can be debugged by setting few System properties. All these properties are set at the BTrace client.

It is better to run the traced JVM with -Xverify:all to force bytecode verification of all classes. This is to make sure that BTrace does not produce bad classes thereby crashing the JVM. After dumping instrumeted classes, it is possible (offline) analyze those using javap tool. The BTrace action methods look like the form: "btrace$<trace-class-name>$<trace-action-method-name>" - where "."s in the trace class name are replaced by "$".

Known Issues and Limitations