TOC PREV NEXT INDEX

 


Watching Variables


To open the Watch Variables window, click the "W" in the tool bar of the main window Select View | Watch Variables from the menubar. The Watch Variables window is shown in Figure 15.

The Watch Variables window displays the variable names and their values at the stack level that is highlighted in the stack display. The values in the Watch Variables window are updated each time the application stops and also each time you select a new stack level in the Stack display in the main window. If a variable name is not defined at the selected stack level, then "<No Value>" appears instead of a value.

Figure 15 The Watch Variables Window

To add a variable name to the Watch Variables window:

  1. Type the variable name in the text box of the Watch Variables window.
  2. Click Add or press the <Return> key.
    The variable name and the current value of the variable are displayed in the large window.
    You can remove a specific variable name by selecting the line, and clicking the Remove button, or clicking Remove All to remove all the variables.

If you select a variable and click the Data Display button, the Data Display window appears.

The Watch Variables window is useful for observing variables in different stack levels that have the same name. For example: suppose the following script is stopped just before executing line 10:


1 proc bar {x} {
2 puts $x
3 }
4
5 proc foo {y} {
6 baz [expr {$y + 3}]
7 }
8
9 set x 2
10 foo $x

The stack display is shown below:


0 global
0 source sample.tcl
1 proc foo y
2 proc bar x

If you are watching the variable named x, you will see the value change as you select different stack levels. At level 2, x has the value 5. At level 1, x is not defined, so "<No Value>" is displayed. At level 0, x has the value 2.




http://www.ajubasolutions.com
Voice: (650) 210-0100
Fax: (650) 210-0101
support@ajubasolutions.com
TOC PREV NEXT INDEX