Live Debugging

Requirements

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

  • JDK and its debug symbols and, for convenience when debugging, source for the standard Java libraries installed. If using distro-supplied versions of JDK:

    RHEL/CentOS/SuSE:

    • java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel packages and $ sudo dnf debuginfo-install java-1.8.0-openjdk-headless , or

    • java-11-openjdk-headless java-11-openjdk-devel packages and $ sudo dnf debuginfo-install java-11-openjdk-headless , or

    • java-16-openjdk-headless java-16-openjdk-devel packages and $ sudo dnf debuginfo-install java-16-openjdk-headless .

    Debian/Ubuntu:

    • openjdk-8-jdk-headless openjdk-8-dbg openjdk-8-source packages, or

    • openjdk-11-jdk-headless openjdk-11-dbg openjdk-11-source packages, or

    • openjdk-16-jdk-headless openjdk-16-dbg openjdk-16-source packages.

  • 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 › Build, Execution, Deployment › Debugger › 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 LiveRecorder › 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.

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

  • Add a LiveRecorder › Remote 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 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 -Dsun.zip.disableMemoryMapping=true -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 above.

  • Run your application.

Refer to Time Travel Debugging in IntelliJ for next steps.