Debugging a Java Card application

JCOP tools allow to debug Java Card applications. As Java Card applications are usually loaded to physical cards which do not have a debug interface, it is not possible to debug the application directly on the card. To overcome this problem, the JCOP Tools uses card simluations that allows the user to debug his applet.

The setup for a card simulation is defined in the Eclipse launch configuration. For details refer to the description in Starting a Java Card simulation. To start a simulation in Debug mode, select either (Run > Debug) from the action bar or use the debug icon in the toolbar.

Start simulation in Debug mode

In the lauch dialog, press the Debug button to start the simulation in debug mode. The JCOP Tools Debug Perspective will be displayed. This perspective contains several views and editors that can be used during the debug session:

The following list describes some of the common used operations/views in a debug session

Setting Break Points

To set a break point within the applet, double-click on the marker bar on the left of the Java Editor. A blue dot with a little check mark indicates an active break point.

Set break point
 

When a break point is hit, execution suspends and the current line of code is highlighted in the Java Editor.

Break point hit
 

View Stack trace
The current stack trace is available in the Debug view, which also contains buttons for stepping, resuming and terminating.

Debug view
 
Inspect Variables
Variables currently in scope can be inspected in the Variables view.

Variables view