Version 6.3.8 for Windows
 —  Debugger  —

Modifying and Watching Variables

This document covers the following topics:


Modifying a Variable

You can modify a variable in different ways:

Modifying a Variable in the Editor Window

You can modify the variable which is shown at the current cursor position in the editor window. In the resulting dialog box, you can also enter the name of another variable to be modified.

Start of instruction setTo modify the variable at the cursor position

  1. Select the variable in the editor by placing the cursor at any position within the variable name.

  2. Invoke the context menu and choose Modify Variable.

    Or:
    Press SHIFT+F9.

    Or:
    When the Debug toolbar is shown, choose the following toolbar button:

    Toolbar button

    The Modify Variable dialog box appears showing the content of the selected variable. In the case of an array, the node is expanded by default.

    Modify variable

  3. To modify the content of the variable, enter the new value in the Value text box.

    Note:
    For variables which cannot be modified (such as unmodifiable system variables) the Value text box is dimmed.

    You can also use the Modify Variable dialog box in the following ways:

    Variables (and occurrences) which you have modified are indicated in red.

  4. When you activate the Hexadecimal Display check box, the content of the variable is shown in hexadecimal format.

  5. Choose the Apply button.

    Your changes are immediately saved when you choose the Apply button. They are not yet shown the in variables window.

  6. To close the dialog box, choose the Close button.

    Your changes are now shown the in variables window.

Modifying a Variable in the Variables Window

You can modify a variable listed in the variables window.

It is not possible to modify an entry which can further be expanded (such as a view). This is only possible for the individual variables after the entry has been expanded.

Different colors are used for the entries in the variables window:

Start of instruction setTo modify a variable in the variables window

  1. Select the required tab in the variables window.

  2. Select the required entry.

  3. Invoke the context menu and choose Modify.

    The Modify Variable dialog box appears showing the content of the selected variable.

    For further information on this dialog box, see Modifying a Variable in the Editor Window.

Top of page

Adding a Watchvariable

If you want to watch specific variables, you can add them to the Watch tab of the variables window.

You can add a watchvariable in different ways:

Note:
It is not possible to modify the content of a watchvariable.

Adding a Watchvariable from the Editor Window

You can define the variable at the current cursor position in the editor window as a watchvariable.

Start of instruction setTo add a watchvariable to the variables window

  1. Select the variable in the editor by placing the cursor at any position within the variable name.

  2. Invoke the context menu in the editor and choose Add to Watchvariables.

    Or:
    Press CTRL+SHIFT+T.

    Or:
    Select the variable in the editor. Use the mouse to drag the selected variable to the Watch tab of the variables window and drop it there.

Adding a Watchvariable from the Variables Window

You can add variables from the first tabs of the variables window to the Watch tab of the same window.

Start of instruction setTo define a variable as a watchvariable

  1. Select the desired variable in the variables window.

  2. Invoke the context menu and choose Add to Watchvariables.

    Or:
    Press CTRL+SHIFT+T.

Top of page

Managing the Variables in the Variables Window

The following topics are covered below:

See also Adding a Watchpoint from the Variables Window.

Showing the Last Modified Variable

You can define that the variables which are modified during debugging are always visible in the variables window. This is helpful when you debug a program which has more variables than can be displayed in the variables window at the same time. When a variable is modified during debugging which is currently not visible in the variables window, the display of the variables window is scrolled in such a way so that the modified variable is visible.

Start of instruction setTo switch this feature on an off

  1. Select any tab in the variables window.

  2. Make sure that no entry is selected on the tab (otherwise, the context menu does not show the required command), invoke the context menu and choose Show Last Modified.

    When this feature is active, a check mark is shown next to this menu command.

Finding a Variable

When the variables window is active, you can search for a variable on the currently selected tab.

Note:
When a node in the variables window is not expanded, its content is not considered in the search.

Start of instruction setTo find a variable

  1. Select the required tab in the variables window.

  2. Press CTRL+F.

    Or:
    Make sure that no entry is selected on the tab (otherwise, the context menu does not show the required command), invoke the context menu and choose Find.

    The Find Variable dialog box appears.

    Find variable

  3. Specify your search criteria:

    Option Description
    Find The string to be found.
    Case sensitive If this check box is selected, only strings are found that exactly match the entry in the Find text box. If not selected, any combination of upper- and lower-case letters will be found.
    Whole word If this check box is selected, the search is restricted to whole words only. If not selected, all occurrences of the string will be found.
    Names When this option button is selected, the string in the Find text box applies to a variable name.
    Contents When this option button is selected, the string in the Find text box is applies to the contents of a variable. That is: you want to find a variable which contains the specified contents.
  4. Choose the OK button.

    When a variable which corresponds to the specified criteria can be found on the current tab, its name is highlighted.

    Note:
    A message is briefly displayed indicating whether the specified text has been found or not.

Start of instruction setTo find the next variable with the specified search criteria

Showing the Content of a Variable in Alphanumeric or Hexadecimal Format

You can define whether the contents of the variables is shown in alphanumeric or hexadecimal format in the variables window.

Start of instruction setTo toggle the format

  1. Select the required tab in the variables window.

  2. Make sure that no entry is selected on the tab (otherwise, the context menu does not show the required command), invoke the context menu and choose Hexadecimal Display.

    When the value in the Contents column was previously shown in the alphanumeric format, it is now shown in hexadecimal format, and vice versa.

    When the hexadecimal format is used, a check mark is shown next to this menu command.

Refreshing the Display

Usually when something changes in Natural Studio, the display is automatically refreshed. In the debugger, this happens when the content of a variable changes. This automatic refresh requires that the corresponding option has been set in the workspace options.

When the automatic refresh has been deactivated in the workspace options and the content of one or more variables changes in the currently selected tab, you have to refresh the display manually in order to see the current values.

There is one exception: Watchvariables are always refreshed automatically, independent of the setting in the workspace options.

Start of instruction setTo refresh the display manually

  1. Select any tab in the variables window (except the Watch tab).

  2. Press F5.

    Or:
    Make sure that no entry is selected on the tab (otherwise, the context menu does not show the required command), invoke the context menu and choose Refresh.

Deleting Watchvariables

You can either delete selected watchvariables or all watchvariables from the variables window.

Start of instruction setTo delete a watchvariable

  1. Select the desired watchvariable in the Watch tab of the variables window.

  2. Invoke the context menu and choose Delete.

    Or:
    Press DEL.

Start of instruction setTo delete all watchvariables

Top of page