Viewing current values
After the debugger pauses at a breakpoint in your code, you can examine the current values of variables or entity properties. You can watch these values and see how they change as each line of code executes.
Viewing variables
The Debugger tab of the Debug pane shows the root entity that is currently available. For example, in activity assignment code, the root entity is an Actvity object. To view any property of the root entity, expand it until you locate the property.
The Debugger tab also shows the variables that you have currently defined. Note, however, that you can view only the entities and variables that are available in the current scope of the code. Suppose, for example, that an Activity entity is available in an activity assignment class. However, if that class calls a different class and you step into that class, the Activity entity is no longer part of the scope. Therefore, it is no longer available. (Unless, you pass the Activity object in as a parameter.)
Defining a watch list
About this task
After executing each line of code, Studio resets the list of values shown in the Debug frame. In doing so, it collapses any property hierarchies that you may have expanded. It would be inconvenient for you to expand the hierarchy after each line and locate the desired properties all over again.
Instead, you can define a watch list containing
the Gosu expressions in which you have an interest in monitoring. The
debugger evaluates each expression on the list after each line of code
executes, and shows the result for each expression on the list. For example,
you can add Activity.AssignedUser to the watch list and then monitor the list as you step through
each line of code. If the property changes, you see that change reflected
immediately on the list. You can also add variables to the list so you
can monitor their values, as well.
- In the Variables pane, right-click the expression, and then click Add to Watches.
What to do next
As you step through each line of code in the debugger, keep the Watches pane visible so that you can monitor the values of the items on the list.
