Debugger allows user to debug programs which are written in languages which are finally generated into Base Language/Java.
MPS java debugger offers the following features:
We start with description of how to debug a java application. If a user has a class with main method, a Java Application run configuration should be used to run/debug such a program.
A Java Application run configuration can be created for a class with a main method. Go to Run -> Edit Configurations menu and press a button with "+" as shown at the picture below:
A menu appears, choose Java Application from it and a new Java Application configuration will be created.
A name should be given to this run configuration, and a main node i.e. a class with a main method should be specified. Also VM and program parameters may be specified in a configuration. Look at Run Configuration chapter to learn more about run configurations.
To debug a run configuration, select it from configurations menu and then press Debug button. Debugger starts, and the Debugger tool appears below.
There are two tabs in a tool: one is for the console view and other for the debugger view. In the console an application's output is shown.
A breakpoint can be set on a statement, field or method. To set or remove a breakpoint, press Ctrl-F8 on a node in the editor or click on a left margin near a node. A breakpoint is marked with a red bubble on the left margin, a pink line inside the editor and a red frame around a node for the breakpoint.
When debugger stops at a breakpoint, the current breakpoint line is marked blue, and the actual node for the breakpoint is decorated with black frame around it.
When at a breakpoint, a Debugger tab can be used to examine a state of a program. There are three controls:
MPS Java debugger allows user to evaluate expressions during debug, using info from program stack. It is called low-level evaluation, because user is only allowed to use pure java variables/fields/etc from generated code, not entities from high-level source code.
To activate evaluation mode, a program should be stopped at a breakpoint. Press Alt-F8, and a dialog appears.
In a dialog there's a MPS Editor with a statement list inside it. Some code may be written there, which uses variables and fields from stack frame. To evaluate this code, press Evaluate button. The evaluated value will appear in a tree view below.