Live Debugging

Requirements

Your application or test case running under an OpenJDK-based or Oracle JVM on a supported Linux distribution.

  • JDK and its debug symbols installed:

    RHEL/CentOS/SuSE-supplied JDK:

    java-<N>-openjdk-devel package, where <N> is 1.8.0, 11 or 17.

    Debian/Ubuntu-supplied JDK:

    openjdk-<N>-jdk-headless and openjdk-<N>-dbg packages, where <N> is 8, 11 or 17.

    Oracle, Azul Zulu, or other OpenJDK-based JDK:

    Debug symbols are included with the JDK download.

  • The ability to copy the LiveRecorder software into this environment.

  • IntelliJ IDEA running in the same Linux environment as your application, or running on a separate Windows, macOS or Linux machine. Refer to Getting started if you don’t already have the Time Travel Debug for Java plugin installed and setup in IntelliJ.

  • If the environment is a remote machine, or a VM or container running on your local machine:
    A port (default 9000) opened into the environment for IntelliJ to connect over.

If your application and IntelliJ are running on the same machine running a supported Linux distribution continue with Local time travel debugging.

If your application and IntelliJ are running on different machines, or your application is running in a VM or container, skip to Remote time travel debugging.

Local time travel debugging

Unzip the file LR4J-Replay-*.zip. This creates a directory named lr4j.

Under IntelliJ Settings › Tools › LiveRecorder › LiveRecorder replay tool directory supply the path to the lr4j directory.

The Time Travel Debug for Java plugin provides Run/Debug configurations for use with LiveRecorder for Java:

  • Open your project in IntelliJ if it’s not already open.

  • From the Run menu choose Edit Configurations and press the + button at the top left of the Run/Debug Configurations dialog.

  • Add a Undo Local Application configuration

    • Choose the Main class of the application that you want to debug.

    • Add additional VM options, Program arguments and adjust other options as required.

Refer to Time travel debugging in IntelliJ for next steps.

Remote time travel debugging

The Time Travel Debug for Java IntelliJ plugin provides Run/Debug configurations for use with LiveRecorder for Java:

  • Open your project in IntelliJ if it’s not already open.

  • Under File › Project Structure… › SDKs check that the JDK version matches the version of the JDK on the remote machine .

  • From the Run menu choose Edit Configurations and press the + button at the top left of the Run/Debug Configurations dialog.

  • Add a Remote JVM Debug configuration

    • Specify the machine running your application as the Host. Use localhost if you’re replaying in a VM or container running on your local machine.

    • Adjust the Port setting to match the port that you opened up into the remote environment above.

On the remote host, VM or container:

  • Unzip the file LR4J-Replay-*.zip. This creates a directory named lr4j.

  • Edit the command-line used to launch your application to add the following arguments to start of the Java command-line.

  -agentpath:/path/to/lr4j/undo-jdwp-agent-1.0.so -javaagent:/path/to/lr4j/undo-jdwp-instrument-1.0.jar -XX:-Inline -XX:TieredStopAtLevel=1 -Dundo.bridge.port=PORT

replacing ``/path/to/lr4j`` with the path to the ``lr4j`` directory, and replacing ``PORT`` to
match the port that you opened up into the remote environment :ref:`above<Live:Requirements>`.

.. note::

   If your application is running under WSL2 on Windows, also add
   ``-Djava.net.preferIPv4Stack=true`` to the command-line arguments.
  • Run your application.

Refer to Time travel debugging in IntelliJ for next steps.