KVM Debugging
These instructions are written to the CLDC package
available from JavaSoft. CLDC is one particular
implementation of the J2ME specification, also developed by
JavaSoft. The steps outlined here will likely be different
for other J2ME implementations.
The KVM must be started with the kvm_g
executable, and you need to pass the -debugger
option. Here is an example:
% cd j2me_cldc/bin
% linux/debug/kvm_g -debugger -classpath \
../api/classes:../samples/classes HelloWorld
Because the KVM does not implement the entire JPDA feature
set, a debug agent, or proxy, is needed. This is called the
KDP and must be started like so:
% cd j2me_cldc/bin/common
% java -classpath tools/kdp/classes kdp.KVMDebugProxy \
-l 2801 -p -cp samples/classes:api/classes
Note that you will need to use JDK 1.2.2 to start the KDP.
This may change in future releases of the KDP.
Now you may start JSwat. I needed to use JDK 1.2, later
versions did not work for me. Connect JSwat to port 2801
using the "Attach" feature via either the item in
the "Debug" menu or the attach
command.
I was only able to connect successfully in console mode.
For some reason the KVM crashed with a segmentation fault
when the JSwat threads panel tried to create a thread death
request object. This may be a JSwat, KVM, or KDP bug -- I do
not know which.
It seems that the KDP process can only accept one
connection per invocation. That is, after any attempt to
connect via JSwat, you will need to restart the KDP process.
This may also be true for the KVM process.
|