Instrumenting a computer program to provide instrumented byte code
includes examining the byte code, selecting portions of the byte code for
instrumentation, and instrumenting the portions to provide instrumented
byte code. Selecting the portions may include choosing portions of the
byte code corresponding to method entry, method exit, a throw, a method
call, or a new line number. Instrumenting a portion of the byte code
corresponding to a method call may include instrumenting a local line
number of source code corresponding to the byte code being instrumented.
Instrumenting the portions may include adding calls to instrumentation
runtime functions that pass parameters indicative of the portions being
instrumented. At least one of the parameters that is passed may include a
line number of the source code corresponding to the portion being
instrumented or a thispointer for the method corresponding to the portion
being instrumented. Data from instrumentation may be passed via a message
stream that is viewed as the data is being generated and/or stored.