You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by Apache Wiki <wi...@apache.org> on 2009/04/15 03:24:16 UTC
[Db-derby Wiki] Trivial Update of "DumpClassFile" by BryanPendleton
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.
The following page has been changed by BryanPendleton:
http://wiki.apache.org/db-derby/DumpClassFile
The comment on the change is:
Notes from Kathey and Rick
------------------------------------------------------------------------------
{{{ java -Dderby.debug.true=DumpClassFile org.apache.derby.tools.ij }}}
- * Reproduce the problem that you're interested in.
+ * Reproduce the problem that you're interested in. It's best if you can narrow the problem down to a single statement that you can execute in your IJ session.
* Exit IJ and look in your current directory. You'll see a file like:
{{{ ac601a400fx0116x4ec6xd381x00000010e1180.class }}}
This is the generated class file for the statement you just ran.
- * Use a decompiler to transform the generated Java class into source code. I've been successful using "jad".
+ * Use a decompiler to transform the generated Java class into source code. I've been successful using "jad". Others have used {{{javap -c}}}. Still others have used 'jode' (see below).
* Now you can read the code!
Some other information about generated class files is documented here:
http://db.apache.org/derby/javadoc/engine/org/apache/derby/impl/services/bytecode/BCJava.html
+ == A shell script for using the 'jode' decompiler ==
+
+ This shell script may prove useful if you are using the 'jode' decompiler to view the generated class file's code:
+
+ {{{
+ #! /bin/bash
+ #
+ # Run the jode decompiler on a class. E.g.:
+ #
+ # runjode acf81e0010x011cxddd8xfcabx0000000feab00
+
+ classStub=$1
+
+ . setupClasspath
+
+ export CLASSPATH=$CLASSPATH:$SW/javaDecompilers/jode/jode-1.1.2-pre1.jar:.
+
+ echo $CLASSPATH
+
+ mkdir org
+ mkdir org/apache
+ mkdir org/apache/derby
+ mkdir org/apache/derby/exe
+
+ cp $classStub.class org/apache/derby/exe/
+
+ #java -cp $CLASSPATH jode.decompiler.Main --help $*
+ java -cp $CLASSPATH jode.decompiler.Main org.apache.derby.exe.$classStub
+ }}}
+