07. Breakpoints - ThisTestUser/Java-Debugger GitHub Wiki

With the release of Java Debugger 2.0, breakpoints can be used to record and/or suspend the execution of the program. Note that this debugger runs on a seperate thread from the main one, and will be allowed to keep going.

Breakpoints_1

To inject a breakpoint, you have to add DebuggerHook.injectBreakpoint() into the code. You can do this with the source of the program or the compiled source using a bytecode editor. It is obviously difficult to do this via a bytecode editor, but I will not be giving instructions on how to do this. Instead, compile a sample program and check the bytecode structure and you can learn how to.

Here are the arguments, which are also available in the source code:

  • clazzName - The class name of the tab that the breakpoint will be associated with.
  • instance The instance of the tab that the breakpoint will be associated with. If the tab doesn't exist, it will be created.
  • loader - The loader to load the class. Used only if the class isn't already loaded.
  • id The unique ID of the breakpoint. Only 1 ID is allowed per class instance.
  • input The variables to analyze. The results can be printed out with the "View" button.
  • mode If the breakpoint should pause the execution of the program. 0 will depend on the pass checkbox, 1 will always pass, and 2 will always pause.
  • override If this is true and there is already a breakpoint with the same ID,the breakpoint will automatically pass and be replaced with this one.

Once this breakpoint is reached, the tab should appear if it wasn't loaded already, and the breakpoint will be loaded, like the image above. The ID shows the ID you put in the arguments, the time is the exact local time the breakpoint was loaded, the time difference shows the difference in time between this and the previous breakpoint with this ID, mode determines if the breakpoint pauses, and pass determines if the breakpoint is "passed" (no longer suspending execution).

You can also view the input array using the "View" button, which will show you each item in the array. Note that you cannot edit these values. If you would like to do this, you'll have to compile a custom debugger that automatically modifies these values.

Breakpoints_2