LSPS documentation logo
LSPS Documentation
Debugging

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.

Debugger Implementation

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:

  1. LSPS Debugger creates in the Execution Engine Java breakpoints: these serve to stop the execution when it encounters an LSPS breakpoint. You can check that the Java breakpoints are in place in the Breakpoints view. If you remove these Java breakpoints, the LSPS debugging will be disabled.
  2. Any LSPS breakpoints present on the server are discarded.
  3. The LSPS breakpoints defined in PDS are uploaded to the server.

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:

  • Sending a token to a process element
  • Changing of goal status
  • Interpreting an expression
  • Assigning a value to a variable
  • Assigning a value to a Record property
  • Creating a record instance
debuggerImplDetail.png
LSPS debugger implementation

Setting up Debugger

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:

  • Local:
    • If you are debugging models and run the Default Application User Interface, debug model instances locally on the PDS Embedded Server
    • If you are developing your custom Application User Interface, debug model instances locally on the SDK Embedded Server.
  • Remote:

Generally, the connection of the LSPS Debugger to a server, remote or local, is defined in a debug configuration. However, the connection to the PDS Embedded Server is integrated in PDS and it is sufficient to modify the server properties.

debugSchema.png
Debugger schema

Debugger on the PDS Embedded Server

To run the PDS Embedded Server in debug mode, do the following:

  1. Go to Runtime Connections > Runtime Connection Settings, select LSPS Embedded Server and click Edit.
  2. 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.

    embeddedServerInDebug.png
    Debug parameters in the PDS Embedded Server configuration

    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.

  3. Click Finish and then OK in the error notification dialog.
  4. Start the PDS Embedded Server.
  5. Create configuration and connect the Debugger:
    1. Switch to the Debug perspective.
    2. Go to Run > Debug Configurations > Remote Java Application.
    3. Click the New button and on the right define the details of the server:
      • Set the host to localhost and port the target port (from the vm arguments above 4000).
      • Enter a Java project name into the Project field (create an empty Java project if no other Java project is available in the workspace).
        remoteDebugConf.png
        Setting debug configuration
    4. Run the debug configuration to attach the LSPS Debugger to the server.
  6. Enable debugging: click the Debug button in the LSPS Breakpoints view.
  7. Now you can debug the model.

Debugger on the SDK Embedded Server

To debug your Custom Application User Interface locally on the SDK Embedded Server, do the following:

  1. Open the Debug perspective.
  2. Go to Run > Debug Configurations > Java Application > <YOUR_APP_LAUNCHER> (for example, MyCustomApp Embedded Server Launcher).
  3. Edit the configuration: add the -DlspsDebug=true VM argument.
    LauncherDebugConf.png
    Setting application launcher configuration to debug mode
    Under the hood, the connection is established on a free port automatically.
  4. Run the launcher configuration in debug.
    RunningDebugAppLauncher.png
    Running the launcher in debug
  5. Enable debugging: go to the Debug perspective and click the Debug button in the LSPS Breakpoints.
    enablingDebug.png
    The LSPS debug is enabled: the Java breakpoints are in place.
  6. Now you can debug the model.

Debugger on a Remote Server

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:

  1. Make sure the server with the LSPS Execution Engine runs in debug mode with the VM arguments:
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=<PORT> -DlspsDebug=true
  2. Open the Debug perspective.
  3. Go to Run > Debug Configurations > Remote Java Application.
  4. Click the New button and on the right define the details of the remote server.
    remoteDebugConf.png
    Setting connection to a remote server
  5. Run the debug configuration to attach the LSPS Debugger to the server.
  6. 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:

    1. LSPS Debugger creates two Java breakpoints in the Execution Engine that are used to stop the execution on LSPS breakpoints.
    2. Any LSPS breakpoints present on the server are discarded.
    3. PDS uploads all LSPS breakpoints to the server.
      enablingDebug.png
      The LSPS debug is enabled: the Java breakpoints are in place.
  7. Now you can debug the model: add breakpoints to the model and run the model.

Debugging a Model

Once you have established connection to the LSPS debugger, and enabled debugging, you can start debugging your model:

  1. Switch to the Debug perspective.
  2. Make sure the Debug view contains the server threads and the Breakpoints view the DebuggerImpl breakpoints.
    debuggerDebuggerImplBP.png
    Local Embedded server in debug mode and debug enabled
  3. If applicable, connect the debugger: run the remote configuration.
  4. Switch to the Modeling perspective:
    1. Add breakpoints to the module resources.
    2. Run the Model.
  5. Switch to the Debug perspective.
  6. If at any point the views do not contain the correct data, double-click the first method in the current thread to refresh the views.
    refreshStuckDebug.png
    Caption text
  7. Manage the debug execution with the buttons in the LSPS Expression view toolbar.

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:

  • Watch Diagram: diagram with the current breakpoint if the breakpoint is on a modeling element
  • LSPS Expression: expression with the current breakpoint if the breakpoint is on an expression
  • LSPS Variables: variables from the current execution context

    This includes modeling elements and their properties, variables, etc.

  • LSPS Watch Expressions: expressions which are evaluated as the model is debugged

Adding and Removing Breakpoints

To add or remove a breakpoint to an element, do the following:

  1. In the Modeling perspective, open the resource with the respective element, such as, variable definition or an expression.
  2. Right-click the element and click Add Breakpoint or Remove Breakpoint.

You can add breakpoints to the following:

  • expressions: right-click the expression and select Add Breakpoint from the context menu.
  • BPMN modeling elements: right-click the element on the canvas and select Add Breakpoint from the context menu.
  • Goals: right-click the element on the canvas and select Add Breakpoint from the context menu.
  • variables: right-click the variable definition and select Add Breakpoint from the context menu.
  • records or their properties: in the Outline view, right-click the record or its property and select Add Breakpoint from the context menu.

Note: Breakpoints on method or function signatures are ignored: if you need to stop at the function or method start, insert the breakpoint on the first expression in its body.

An added 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.

activeBreakpoint.png
Active breakpoint in a Goal hierarchy

Defining a Breakpoint Condition

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.

Resuming Breakpoints

To resume a model instance to the next breakpoint, click the respective button, such as Resume, Step Over, etc., in the LSPS Expressions view.

Enabling and Disabling Breakpoints

You can disable and enable LSPS breakpoints as well as define breakpoint conditions in the LSPS Breakpoints view.

Tracker

Note: Execution Tracker is deprecated. Use the Debugging feature.

To acquire information on runtime data, you can use the Execution Tracker: it provides details about actions during model instance execution; typically you will run tracking only for that part of the model execution you are interested in.

You can enable the Tracker by running the server with the -Dcom.whitestein.lsps.lang.Tracker=true JVM option. To start and stop tracker, go to the Model Management perspective and display the Tracker view (Window > Show View > Other; and in the Tracker View, click the Start Tracking ( ) button to start execution tracking. Perform the required steps and stop the tracking to display the tracking information.

trackerView.png
Tracker view with output