The Watch

Top  Previous  Next

The watch is a facility which allows you to inspect and change the current value of variables and object properties. You can only use this facility when you are in debug mode and when the program execution is stopped. TIDE is unable to fetch variable values while the Virtual Machine is running. Depending on the scope of the variable, there may be additional limitations as to when you can inspect this variable's value.

The watch updates variable values by reading them from the target every time the Virtual Machine is stopped. If any item on the list changed its value since the previous fetch, this item will be displayed in red.

Watch facility may be accessed by three different ways:

The Watch Pane

The watch can be toggled by View > Watch. It looks like this:

 

tide_watch2

 

On the above screenshot we can see the status of a short, a string, a property of an object, a member of an array, one user-defined structure, and an undefined variable. Notice, that the "x(y)"  is displayed in red indicating that its value has just changed. Notice also that this line shows an array indexed by another variable (y). This is not the limit of the watch pane's abilities -- try entering more complex expressions, it will work!

 

tide_button_addwatch

There are several ways of adding variables and object properties to the watch list. You can:

Press Insert while the watch pane has focus -- this will bring up an Add to Watch List dialog. Type the name of a variable or  property to watch and press OK.
Alternatively, double-click on the empty space in the watch pane to obtain the same result.
You can also select Debug > Add to Watch List from the Menu.
Additionally, there is an Add to Watch List button on the Debug toolbar.
You can right-click on the variable or property in the source code and select Add to Watch List from the context-sensitive menu.
You can also right-click on the property in the Project pane (Browser tab) and select Add to Watch List.

 

In the Add to Watch List dialog you may type multiple items to be added to the watch by separating their names with commas (i.e. "i, j, k, ser.num"). For objects you will get a drop-down list of available members:

 

add_to_watch

 

Double-clicking the Name column in the watch pane will allow you to edit the name of the item you want to watch.

The watch pane also allows you to change the value of any variable or object property (provided it is not a read-only property). Double-click on the value field - you will be prompted for a new value.

For numerical variables, you may use hex or binary notation (&h, &b). For strings, you will be presented with the "HEX editor" allowing you to modify the string or the HEX codes of its characters:

 

string_edit

 

Once a new value is entered, it will be actually written to memory on the target, and will be read again before being displayed in the watch. So when you see your new value in the value column, that means it's actually in memory now -- what you see is what you get.

The watch pane is one of the places where enumeration types become very useful. Look at sys.runmode above. Because its possible values are described through an enum, you can see a meaningful state description, rather than just a number. This is one of the main reasons for the existence of enumeration types in Tibbo Basic.

tide_button_removewatch

To remove a variable from the watch, select it and press Delete, select Debug > Remove from Watch List or click the Remove from Watch List button on the Debug toolbar.

The Watch Tooltip

This is the watch tooltip:

 

tide_watch_tooltip

 

When you hover the mouse cursor over an identifier in the source while in debug mode you will see a tooltip with the current value for this identifier.

 

note_further-wt

For now, this won't work for arrays. If you want to inspect the values of an array add this array to the watch list.

The Project Browser

tide_object_tree

 

The Project Browser is a tab in the Project pane, which can be toggled by View > Project. It displays all objects for your platform, with the properties and methods for each object. It also displays all procedures and global variables in your project.

While debugging, you can see the value of an object property or a global variable by hovering over its identifier in the tree.