db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "DumpClassFile" by BryanPendleton
Date Sat, 17 Nov 2007 18:05:37 GMT
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

New page:
To execute various queries, Derby generates Java classes on the fly, then executes that generated
code.

To study a particular Derby issue, you may find yourself wanting to view that generated code.
For example, DERBY-2352 involves understanding what code is generated for various expressions.
DERBY-739 is another example.

Here's a simple technique that will allow you to view the generated code:

 * Run Derby with the argument -Dderby.debug.true=DumpClassFile:

   {{{ java -Dderby.debug.true=DumpClassFile org.apache.derby.tools.ij }}}

 * Reproduce the problem that you're interested in.
 * 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".
 * 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

Mime
View raw message