Time travel debugging in IntelliJ¶
If you’re replaying a recording, use the
Or if you’re debugging remotely, launch your application on the remote machine supplying the LiveRecorder agents on the Java command-line.
Consider adding breakpoints and/or watchpoints before starting the debugger session since your application or recording will start running as soon as you press the Debug button.
Start the debugger session¶
Choose a Run/Debug configuration from the Run/Debug Configurations dialog and press the Debug button to start debugging.
While your application is running, you can’t interact with it or examine application state. You can only Pause, Stop or Rerun your application. See IntelliJ tips for more info.
Once your application is suspended due to hitting a breakpoint or watchpoint, you can examine variables and the contents of the stack and evaluate arbitrary expressions. Refer to the IntelliJ documentation for details. You can’t alter variables while time-travel debugging, since doing so would likely change the future execution of the application and cause the timelines to diverge.
Forward and reverse execution¶
You can use the familiar Step Over, Step Into, Force Step Into, Step Out and Run to Cursor buttons to step the application forwards, or the Resume button to run the application forwards until it hits a breakpoint or watchpoint.
LiveRecorder for Java adds the Reverse Step Out, Reverse Step Into and Reverse Step Over buttons, which you can use to step the application backwards, and the Resume Back button to run your application backwards until it hits a breakpoint or watchpoint.
LiveRecorder for Java allows you to set bookmarks in a recording to which you can later return. They are displayed in the TimeTravelBookmarks tool window (View › Tool Windows › TimeTravelBookmarks) as shown below:
Use the START and END bookmarks to jump to the beginning or end of your application’s execution history.
Use the Add Bookmark button to add a bookmark at the current point in time in your application’s execution history. You can return to this point in time by clicking on the bookmark.
Bookmarks are automatically ordered by their place in the execution history and display the location as well as the bbcount.
Bookmarks are not persistent and only exist for the lifetime of the session.
As an alternative to the Log Jump window you can also open a log file in the LogViewer window (View › Tool Windows › LogViewer). If the log file contains a timestamp at the start of each line in one of the recognised formats, just clicking on that line will take you to the approximate location.