There are different tools for debugging Jikes RVM:
There is a limited amount of C code used to start Jikes RVM. The rvm script will start Jikes RVM using GDB (the GNU debugger) if the first argument is
-gdb. Break points can be set in the C code, variables, registers can be expected in the C code.
The dynamically created Java code doesn't provide GDB with the necessary symbol information for debugging. As some of the Java code is created in the boot image, it is possible to find the location of some Java methods and to break upon them. To determine the location use the RVM.map file. A script to enable use of the RVM.map as debugger information inside GDB is provided here.
Details of how to manually walk the stack in GDB can be found here
Other tools, such as valgrind, are occasionally useful in debugging or understanding the behaviour of JikesRVM. The rvm script facilitates using these tools with the '-wrap' argument.
For example, cachegrind can be invoked by
The command and arguments immediately after the -wrap argument will be inserted into the script on the command line that invokes the boot image runner. One useful variant is
Jikes has an interactive debugger that you can invoke by sending SIGQUIT to Jikes while it's running:
pkill -SIGQUIT JikesRVM
In previous versions of Jikes, that stopped all threads and provided an interactive prompt, but currently it just dumps the state of the VM and continues immediately (that's a known issue: http://jira.codehaus.org/browse/RVM-570).
In general the JPDA provides 3 mechanisms for debugging Java applications:
- The Java Debug Interface is an API for debugging Java code from Java.
- The JVM Tools Interface is an API for writing native/C code for debugging a JVM, it is similar to the Java Native Interface (JNI).
- The Java Debug Wire Protocol is a network protocol for debugging Java code running on JVMs.
Currently JDWP code is being implemented in Jikes RVM based on the GNU Classpath implementation.