Java Reference
In-Depth Information
generated it. This relationship between byte code, your code symbols, and their
original source files and line numbers is called symbolic debugging information , and
it isn't strictly required by the JVM to run your program. After all, the JVM
doesn't care that line number 3,310 from the file LogonEventListener.java
added 1 to the value of the variable logins ; it just executes the byte code to
make it happen.
But you do care—unless you speak byte code. That is why when you compile
your application, you must tell the compiler to preserve this information and save
it as part of the generated class file. Fortunately, this is the default mode in most
compilers, but you must be aware of this fact when specifying your compilation
options. Why would you ask the compiler to omit this information? Because
doing so reduces the size of your class files and may help protect the class files
from reverse engineering. For this reason, some developers choose to compile
their application twice, creating a debug version (which they keep) and a produc-
tion version (which they deploy). For the production version, they omit the sym-
bolic debugging information for the reasons stated earlier.
Compiling the latest version of your code
Given that the debugger works by mapping the running byte code to the original
source code, it stands to reason that the two must be in sync. If your source code
has been modified since you compiled and executed your application, then the
debugger is unable to accurately report on its progress. When lines of executing
source don't match up to your local source, things can get very confused, very
quickly. We've all been caught watching the debugger step through yesterday's
class with today's source. For that reason, it's best to always perform a clean build
of your application before firing up the debugger, to make sure everything is
properly updated.
Gathering third-party source code
If you're using any third-party libraries and have their source code, it's a good
idea to add it to your project. Sometimes during your debugging you'll want to
follow the program flow into these libraries to understand where a problem is
occurring. (Maybe it's a bug in a vendor library and not your fault!) If you have
access to all the source code, you'll more easily be able to tell what's going on.
Disabling the JIT
The just in time compiler ( JIT ) is a component in the VM that helps improve the
performance of running applications. It works by caching generated machine
 
 
 
 
 
 
 
Search WWH ::




Custom Search