Run, pause, reboot
In the debug mode, your target may be in one of these states: *RUN * , ** PAUSE ** , *BREAK * , ** ABORT **. The Target States topic offers more info on the subject.
The RUN state is entered by pressing [F5] or selecting Debug > Run.
The PAUSE or BREAK state is entered when you do Debug > Pause.
In addition, the VM may BREAK on reaching a breakpoint.
Debug > Restart reboots the target. The execution won't start automatically.
The target will emerge in the PAUSE state and will be waiting for you to hit [F5].
Breakpoints are pausing places in your code.
To toggle (set/clear) a breakpoint, click on the gray border on the left side of the source code pane.
You can also press [F9] to toggle a breakpoint on the line where your | cursor currently is. Of course, there is a menu item as well.
View > Breakpoints displays a handy Breakpoints pane.
Breakpoint placement rule
A breakpoint may be placed only on a line which contains executable code. Before you compile your project you can place breakpoints anywhere. On compile, a breakpoint placed on a line containing no executable code will be shifted down to the nearest "code-bearing" line.
You can toggle breakpoints at any time — even when the target is executing ( RUN ).
Each additional breakpoint slightly reduces the execution speed.
The program pointer and stack
Whenever your target is in the BREAK state TIDE shows the program pointer.
This is a bright yellow line (and a small triangle on the left) that highlights the next line to be executed.
Another kind of highlighting — in blue — shows program locations that are currently on stack (More.
The blue highlight is shown on the line that will be executed next after the control returns to the corresponding procedure.
Vew > Call Stack displays the Call Stack pane and the current "nesting" of procedures.
Whenever the execution stops, TIDE displays the amount of time elapsed since the execution has begun or resumed.
This allows you to profile your applications, i.e. measure the amount of time various parts of code take to execute.
Here is what's possible when the target is in BREAK:
[F8] or Debug > Step Into executes the line where the program pointer is. If the current line calls up a procedure you will "step into" it.
The is the way to execute the smallest possible portion of your program (more).
In some rare occasions the stepping won't work. For example, you cannot step through this infinite loop: label1: goto label 1. Pressing [F8] here is like pressing [F5].
[F10] or Debug > Step Over is like "step into" but if the current line calls up a procedure the entire procedure will get executed.
The execution will stop on the next line after the procedure call.
This is a way to "concentrate" on the current procedure without going into trifle details (of what's going on in subordinate procedures).
[SHIFT]+[F11] or Debug > Step Out runs until the end of the current procedure.
The execution will stop on the next line after the line that called up this procedure.
[CTRL]+[F10] or Debug > Run to Cursor executes all code from the program pointer to the line where your | cursor is now.
[CTRL]+[F11] or Debug > Jump to Cursor skips all the code between the program pointer and the line where your | cursor is now.
No execution takes place. This is a very cool feature allowing you to try things when debugging.
Whenever your target is in PAUSE or BREAK you can inspect variables and object property values.
Debug > Add to Watch List to add an expression to the Watch pane ( View > Watch).
Have you noticed that I've just used the word expression? That's for a reason — the Watch can do much more than just show you variable values.
There are also Watch tooltips — just mouse over a variable or an object property to inspect its value.
This won't work for arrays, structures, and unions — these can only be inspected in the Watch pane.
Tooltips also work in the Project Browser and File Browser.
When using watch tooltips, be mindful of the current scope (context).
Whenever your target is in BREAK, this pane automatically shows you the current values of all local variables visible in the current scope.
Use the sys.debugprint method to send messages from your application and into TIDE's Output pane ( View > Output). This is very useful for execution tracing:
** Tibbo Basic **
... sys.debugprint("Branch 1\x0D\x0A") ... sys.debugprint("Point 1, x="+str(x)+"\x0D\x0A") 'Send along the current value of x ...
As the execution proceeds the Output pane will catch debug messages from your device:
** Tibbo Basic **
Branch 1 Point 1,x=10
Target communications status
During debugging, the Status bar shows you the status of communications with the target:
The green circle is moving from side to side: all is good — the target is responding.
The yellow circle isn't moving or moving slowly and sporadically: something may be wrong.
The circle is red and it's not moving at all: lost the target!
To finish debugging
[ESC] or select Build > Stop Build/Upload/Debug to exit the debug mode completely.
Exiting doesn't affect the execution state on the target.