in java is possible to remote debug an application using "socket attach" connection and follow program flow via Eclipse debugging tools.
To do this is needed to start the remote JAR using special parameters as the follows:

On the kindle touch JDB remote debugging is built in and can be enabled without a jailbreak. Older kindles do not have any debugging features built in and would require you to recompile CVM with debug support.

To elaborate a little on yifanlu's statement: On the Kindle Touch, via ssh, you just have to
1. > mntroot rw
2. > vi /etc/upstart/framework
3. (if not yet familiar with vi, learn to use it)
4. find the commented-out line with the debug configuration (starts with #DEBUG), remove the # and change to suit (i tend to set suspend=n), save it
5. (i usually mntroot ro immediately when i don't need rw anymore)
6. > restart framework

Then you can connect to the VM on the kindle through the usbnetworking.

Obviously, the most daring task of those is number three *g*. Not sure if any editors besides vi are on the kindle, but you could of course always scp to/from your development machine and use your preferred one.

To elaborate a little on yifanlu's statement: On the Kindle Touch, via ssh, you just have to
1. > mntroot rw
2. > vi /etc/upstart/framework
3. (if not yet familiar with vi, learn to use it)
4. find the commented-out line with the debug configuration (starts with #DEBUG), remove the # and change to suit (i tend to set suspend=n), save it
5. (i usually mntroot ro immediately when i don't need rw anymore)
6. > restart framework

Then you can connect to the VM on the kindle through the usbnetworking.

Obviously, the most daring task of those is number three *g*. Not sure if any editors besides vi are on the kindle, but you could of course always scp to/from your development machine and use your preferred one.

Even easier (and you don't have to risk losing amazon updates by modifying the rootfs): go to USB mode and mount on the Kindle's USB drive, make a empty text file named "DEBUG_CVM_JDWP". Then restart and switch to usbnetwork mode. You debug with usbnetwork's IP.

Obviously, the most daring task of those is number three *g*. Not sure if any editors besides vi are on the kindle, but you could of course always scp to/from your development machine and use your preferred one.

I have a nano editor with no (extra) library dependencies that I keep in my /mnt/us/bin folder on my kindle touch. As I recall, I just copied it from the loop-mounted optware directory that I use in my kindle 3, and it "just worked". I use "vee-eye" when I must, but I never learned to *love* it. At least I am not addicted to emacs.