Java Debugger Tutorial|Java Debugger Techniques

Java Debugger Tutorial|Java Debugger Techniques
The basic Java debugger is very similar to gdb and the commands it under-
stands.3 The command to launch is jdb StartClass and it launches a second
JVM to debug the program that waits for continued execution. Breakpoints can
be set by using stop at AClass:aLineNumber or stop in aCompleteMethod-
Name, or stop in AClass. for stopping at the constructors, or stop in
AClass. to stop at the initialization of the class.
next advances to the next line.
step advances to the next line within current scope.
run starts execution.
cont continues execution after a breakpoint has been found.
print prints values of the subsequent fields/method calls.
dump is more complete with all values of fields dumped.
threads lists the number of threads.
thread selects the thread with number indicated afterwards.
where dumps the stack.
where all dumps all the stacks.
catch can catch an exception on-the-fly.

Read more...

Java Virtual Machine Architecture|Java Virtual Machine Tutorial|Java Virtual Machine Launcher|Java Virtual Machine Specification

Java Virtual Machine
Table 2: Java Virtual Machine main options
java
Adds the path to the CLASSPATH value
-classpath path,
for this execution
-cp path
-verbose [:class—gc—jni] Output messages on classes/garbage
collection/java native interface to
show the effected operations
Gives the current version and exits
-version
Print help
-help, -?
Print non-standard options
-X
e.g. -Xmssize e.g. Set the initial heap size.
e.g. -Xsssize e.g. Set the thread stack size.
The Java Virtual Machines (JVM) are the execution environments for Java
programs (see Table 2). A JVM is intended to act as an interpreter for the byte
code. Thus the byte code is itself portable from one platform to another. Java
virtual machines have to be ported and installed on the respective platforms
prior to program execution.
By default, the argument class name will be loaded and the main method
within this class will be called as a starting point. The JVM takes care of
memory allocation and deallocation. In particular, the JVM manages automatic
garbage collection of instances and code when not used any more .
While interpretation is slow in general, a JVM has lots of facilities to speed
up execution. The most important one is Just-In-Time (JIT) compiling which
compiles the byte-code to native code when it is loaded, thus giving near native
performance on the use of a class once it has been executed at least once. Of
course this initial translation yields a performance penalty at first execution of
given method.
If MyMain is the class containing the bootstrap code, the program can be
launched as follows:
java MyMain

Read more...

  © Free Blogger Templates Modic Template by For more Information : click Here

Back to TOP