How to Debug

Parent Previous Next

How to Debug.

Once you have loaded the files as described here, you are ready to debug the execution.

Trace Events With Extra Fields.

Each recorded trace event is presented in a sequential order on the Trace Events tab-page. The events are shown as a list with lots of information about the VM, project, source file, class, function, source code statement etc. Much of this information is not part of the trace file but are "just-in-time-virtual-fields" which are calculated by the debugger.


Here is a small subset of text lines copied from the trace file, demonstrating how events appear in a short form notation in the trace file. The text lines identifying values are here written using a red color:









The next figure shows how this information is translated into a list with lots of extra virtual fields. Please notice how the text line marked in yellow corresponds to event 40906 also in yellow:

Please notice the Find Value search function located at the bottom. Use this to quickly jump to an event containing a known value.

In case the trace events are not presented with all these extra virtual fields then you probably have loaded a trace file and a CUF with different time-stamps. The same happens if no CUF is currently loaded. As described here it is imperative that the CUF and the bytecode (which generates the trace events) are created in the same compilation in order for the referenced time-stamps to match. If they differ then it is not possible to calculate the virtual fields or debug the execution of events.

The list of trace events uses a coloring scheme:

TIP: The "Level" column works like this:

  • All source code events for every function have a level that show their call path position. Level 0 always refers to source code within the Main function of the Main class (The Main Entry Point). Level 1 is used for source code belonging to a function, which has been called from level 0. To expand on this just think about multiple functions F0..FN where F0 calls F1 that calls F2 that calls F3 that ... calls FN.
  • Levels are important in order to present the call stack and to perform functions like "Step In", "Step Out" etc.

Source Code and Breakpoints.

Once one or more CUF files have been loaded, the tab-page Debug Execution can present a tree of project(s) and source file(s) sorted in alphabetic order. When you click on a source file the textual content is presented with the usual formatting.

You can set a breakpoint on any individual line within the source code. While executing the events, each event is checked to see whether it references source code that is marked with an enabled breakpoint to pause the execution.

Breakpoints can be enabled or disabled making them all either active or inactive. Whether this internal status flag is on or off, it is still possible to set or remove breakpoints although they will all have the same status.

Start Debugging.

Debugging is primarily done using the multiple run and step functions of the Debug menu. These functions will execute the events and present the activity on the Debug Execution tab-page:

However, in addition to these ordinary debugger facilities you also have the option of working with the Trace Events tab-page directly:

This possibility can be very useful when working with loop structures to identify and debug a particular loop event.

Please also notice the possibility of temporarily disabling the breakpoints - e.g. when using the Run to Cursor function or similar functionality.

Call Stack Entries.

The Call Stack tab-page presents the path of function calls leading up to the current point. Each entry in the list can be double-clicked to jump to the location in the source code. When a function is called, the event responsible is added to the list, and when the called function complete execution and returns to the point of call the last entry is deleted from the list.

The path of calls until now. The first call (here event 8) was done from inside the Main function of the Main class.

Please notice:

Trace Values.

While executing the events, all passed events containing values are presented in the Trace Values tab-page. New values are inserted at the bottom of the list, written using a red color. If a value from eventN is generated by source from eventN-1 then the Source, Level, Function and Class of eventN-1 are included, written in black.

The values passed up to this point. For the selected line the value 0x13 (assigned to newByte) belongs to event 40903, and the black fields belong to event 40902.

This functionality is especially useful when single-stepping each statement using the F7 function. Whenever you execute a statement which involves a variable being assigned a value, the assignment and the value can be monitored simultaneously.

Please notice an entry in the list can be double-clicked to jump to the value event in the trace list.