This article describes how to debug Java Card applets in a simulation environment.
Start the Jcop debugger by simulating debugging in eclipse with Jcop. We can see for example by:
To simulate debugging, is to enter JCOP-related instructions in the command input box, by reading the JCOP help document, we see that JCOP provides a variety of commands, about 40.
Here are some of the frequently used ones to illustrate:
1. Reset Card: "/atr". Assuming that no matter what the number of parameters, the immediate reset.
2. Send command: "/send", this is the most intuitive debugging instructions.
Can be sent to the emulator one-by-one, similar to the actual environment inside the reader and card interaction. The number of references after the send instruction. Can not add a space, assuming that no matter what the control, Jcop implicitly feel hexadecimal. Add "|". Converts the characters to 16, adding "#". The value of the length of the subsequent character can be computed. Example:
/send 00a404000e315041592e5359532e4444463031 (no matter what the control character)
/send "0102|ab|03 04|cd" ==>/send 01 02 61 62 03 04 63 64
/send "01# (|ab|#{fe ff})" ==>/send (FE ff)
3. View the version number:"Version".
The above is an instruction-by-input scenario that can be combined with Eclipse's breakpoint functionality. View changes in the value of variables during program execution.
Let's say we have multiple instructions to run together, allowing the emulator to run the script directly.
For example, in the case of personalization, or stability testing, the following methods can be used:
1. Set the internal variable: "/set-var". Set the path for the script to run, for example, in the command input box:
/set-var path "E:\JCOP_Script"
2. Under "E:\JCOP_Script" This path, write the corresponding script, for example I write:
Please note the following:
A. The name of the file I wrote is "Perso1.jcsh". The suffix must be. jcsh;
B. Gaze please start with "#";
C. The content is composed of the JCOP directives of each article.
3. Because I wrote the filename is perso1.jcsh. Enter Perso1directly in the instruction box, and you can.
You can see the instructions in the JCOP to run the file.
JAVA Card Application Development (v) debugging method of Jcop