Prashant is the Oz behind Chronon. Inspired and frustrated by years of breakpoint guesswork in the current debuggers and fumbling with printin() statements and logging frameworks, Prashant set out to find a different way to debug programs. Chronon is the result of his efforts. Prashant has posted 22 posts at DZone. You can read more from them at their website. View Full User Profile

Java Bytecode manipulation : Tools of the trade

12.08.2011
| 5880 views |
  • submit to reddit

Since the Chronon recorder uses bytecode instrumentation to record your java applications, I thought I would list some of the tools we use to help us with it:

ASM framework

The de-facto Java framework for bytecode manipulation. The ASM framework is the fastest, most flexible and well known framework around for doing bytecode manipulation.  At the time of writing its the only framework that supports the Java 7 class file format. If you are trying to choose a framwork for bytecode manipulation, stop, just learn and use ASM.

Bytecode Outline plugin

This eclipse plugin can automatically show you the bytecode for java file open in your editor. It can also show the corresponding ASM code that would be needed to generate the said bytecode. It will help you understand both bytecodes and the ASM framework better.

jClassLib Bytecode Viewer

This free tool, made by the same guys who make JProfiler, is the most comprehensive way to view your generated .class files. It can show you the bytecodes individually for a method along with things like the local variable table, exceptions table, constant pool, etc.  Its a must have, in my opinion, if you are fiddling around with Java byetcodes in any way.

Chronon Time Travelling Debugger

This may sound like self promotion, but I remember the time before Chronon was born and each time we would run into issues with the generated bytecode, (which btw you will at some point too, no matter how hard you try not to), it would take hours trying to use the standard debugger or littering our code with println() statements everywhere before we found the root cause. Now if we find any error in the generated bytecode, we just look at the Chronon recording of the executed code in the Time Travelling Debugger and can find root cause in minutes.

 

From http://eblog.chrononsystems.com/java-bytecode-manipulation-tools-of-the-trade

Published at DZone with permission of its author, Prashant Deva.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Ash Mughal replied on Wed, 2012/01/25 - 7:13pm

The de-facto Java framework for bytecode manipulation. The ASM framework is the fastest, most flexible and well known framework around for doing bytecode manipulation.  At the time of writing its the only framework that supports the Java 7 class file format. If you are trying to choose a framwork for bytecode manipulation, stop, just learn and use ASM.

Does this ASM framework also support older version of Java or this is the only addition in Java 7?

new java

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.