Is it possible to view dynamically generated bytecode in eclipse?

I know of several solutions for files that end in ".class" where you can use the ByteCode Outline plugin or the Bytecode Visualiser plugin or even the built-in "javap-like" viewer for classes.

But I need this ability for runtime code when debugging! What I am trying to achieve is to see the actual generated code when doing a clojure call. This uses ASM to generate classes on the fly.

+3


source to share


2 answers


Using the eclipse IDE, you can combine JAD (java decompiler) with JADClipse to decompile your class files on the fly whenever the debugger tries to open a class file that has no associated source. Without eclipse, you can use JAD as an independent executable, but it is less user friendly.



JAD will generate java source for the class file even if it was built with Java assembler. This is possible because java is close enough to the functionality of jvm. The only class files it doesn't work on are the ones that were run through an obfuscator to prevent decompilation

+1


source


Besides JAD, there are other tools. One of them is called JD (Java Decompiler) . It also has an eclipse plugin and is slightly better than JAD since it supports Java 5, JAD only supports Java 4 (as far as I know there hasn't been any JAD development since 2001). A tool that seems to support Java 6, DJ Java Decompiler , but I haven't tested this yet.



And I don't know if any of these tools really support on-the-fly code, on the other hand, I really don't understand why they shouldn't.

0


source







All Articles