To debug your models, run LSPS Server in debug mode, add breakpoints to modeling elements in your diagrams and expressions, and run the model on an LSPS Server; both the JVM and the LSPS Server must run in debug mode.
To debug your models, both the Execution Engine and the underlying JVM must run in debug mode. After you start the Execution Engine and JVM in debug mode, you can enable the debug mode in PDS. At that moment, the following happens:
When you then run a model instance in debug mode with LSPS breakpoints on its modeling elements and expressions, and the execution hits a breakpoint, in an execution step, the breakpoint condition is evaluated and if the condition evaluates to true, the LSPS Debugger notifies the Java Debugger to suspend the execution in the execution step.
An execution step is any of the following:
You can connect the LSPS Debugger and debug a model instance that runs on an Execution Engine in a local JVM or on a remote JVM. Generally, you have the following options:
Generally, the connection of the LSPS Debugger to a server, remote or local, is defined in a debug configuration. However, the connection to PDS Embedded Server is integrated in PDS and it is sufficient to modify the server properties.
Note: The instructions are summarized also in a screencast.
When debugging on PDS Embedded Server, PDS connects to the server as to a remote server.
To run PDS Embedded Server in debug mode, do the following:
In the VM Arguments field, add arguments that will run the JVM and the Execution Engine in debug mode:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4000 -DlspsDebug=true
The -DlspsDebug=true
argument runs the Execution Engine in debug mode; the address argument defines the target port: you might provide another port number if required.
Important: Make sure the user used to establish the connection, in the example it is the admin user, has the security right for debugging: run the server, go to the Management perspective; and in the Person view, check that at least one security role of the Person has the
Debugger:Manage
permission.
localhost
and port the target port (from the vm arguments above 4000
).Now you can debug the model: add breakpoints to the model and run the model.
Important: If your breakpoints are on expressions or code, not visual modelling elements, the debugger might be stuck before reaching the breakpoint: in such a case, double click the first method in the current thread to refresh the views.
Note: The instructions are summarized also in a screencast.
To debug your Custom Application User Interface locally on SDK Embedded Server, do the following:
MyCustomApp Embedded Server Launcher
).-DlspsDebug=true
VM argument. Important: Only one user can connect to the Execution Engine in debug mode since, on connection establishing, any LSPS breakpoints on the server are discarded. If you need to prevent such a scenario, restrict the access of users to the debug feature: remove from persons any security roles with the
Debugger
security right.
To set up LSPS debugging, do the following:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=<PORT> -DlspsDebug=true
To start debugging, go to the Debug perspective and click the Debug button in the LSPS Breakpoints to enable the debugging.
When debugging is enabled, the following takes place:
Once you have established connection to the LSPS debugger, and enabled debugging, you can start debugging your model:
When the model instance hits a breakpoint, the Java thread of the Execution Engine is suspended. Note that the model instance state remains unchanged.
Once suspended, you can examine the model instance in the following views of the Debug perspective:
LSPS Variables: variables from the current execution context
This includes modeling elements and their properties, variables, etc.
To add or remove a breakpoint to an element, do the following:
You can add breakpoints to the following:
Important: Breakpoints on method or function signatures are ignored (add a breakpoint to the first expression in their bodies).
A breakpoint appears in the LSPS Breakpoints view in the Debug perspective and is displayed as a dot marker in the diagram.
When the breakpoint is triggered, it is visualized either in the Watch Diagram or in the LSPS Expression view, depending on the breakpoint type.
If a breakpoint defines a condition, it is activated only if the condition evaluates to true when the breakpoint is hit.
To add a condition to a breakpoint, select the breakpoint in the LSPS Breakpoints view and define the condition in the Condition area below.
Important: It is not possible to define a breakpoint on a loop with a condition so as to have the breakpoint activated at a certain iteration.
To resume a model instance to the next breakpoint, click the respective button, such as Resume, Step Over, etc., in the LSPS Expressions view.
You can disable and enable LSPS breakpoints as well as define breakpoint conditions in the LSPS Breakpoints view.