JIVE is a Java debugging tool that allows Eclipse to do forwards and backward debugging. Backwards debugging (also called reverse debugging) allows the user to rewind the program to previous states. This allows the user to go back and time and see what led to incorrect program state. JIVE also has some sequence and object diagramming capabilities.
JIVE does not work on the latest Eclipse versions (as of 20190311, Eclipse 2018-12 does not work). I have tested with Oxygen 4.7.3a and it works in that version of Eclipse. You can try other versions of Neon, Oxygen, or Photon, but they may not work.
Once you have a compatible version of Eclipse, you need to install JIVE. Instructions can be found on the JIVE website. The basic steps are:
- Go to
Help > Install New Software...
- Enter name 'JIVE' and URL
- Check the box by the JIVE software to install and proceed through the dialogs
Once JIVE is installed, you need to get it ready to use. Some tutorials are available. Here is the basic setup to use it with a project:
- Open a Java project
- Debug the project at least once to make a debug configuration
- Go to
Run > Debug Configurations...
- Click on the JIVE tab
Enable Debugging with JIVE
Now you can use the drop-down arrow by the debug icon or
Run > Debug As... to debug with JIVE. This should automatically select the JIVE perpsective.
You should have a new parallel add project in your repo. Set a breakpoint at the final print statement. Debug the program using JIVE. It should stop at the breakpoint you just set. The sequence diagram should show all 8 threads and their corresponding run times. What are the colors used for the threads?
You can rewind time by right-clicking a time slice in the sequence diagram and saying 'Jump to' and selecting a target. This can let you see the control flow through the program, but you cannot observe varaiable results easily.
Use search to find when each thread starts. Go to
Search > Search... and click on the JIVE search tab. Find a Method Called with the name
run. You should get a list of the calls in the lower left pane, which tracks to the sequence diagram.
You can also search for variable changes. Search for changes to the
finalSum variable. Inspect the changes to the variable. How does JIVE mark changes in the sequence diagram?
What happens to the object diagram as you switch between variable change instances?
Comment out the thread join near the end of the program and run the code again. Do you notce any differences in the sequence diagram?