Using the WDB GUI ·
Using the Local Variables View
Home and Help Icons Keyword Index Home Using Help
Line Graphic
Line Graphic

Contents

Keyword Index

Using the WDB GUI
Starting and Exiting the WDB GUI
Loading a Program and Changing Program Settings
Opening Source Files
Changing the Working Directory
Saving and Restoring Debug Sessions
Setting Source Paths
Setting Object Paths
Viewing Your Code
Browsing Functions
Setting Signal Handling
Finding Specific Text in Your Code
Using the Command View
Using the Watch View
Using Quick Watch
{short description of image} Using the Local Variables View
Using the Call Stack View
Using the Threads View
Using the Registers View
Examining Memory Use
Using the Program Console
Using Breakpoints
Advancing Through Your Program
Fixing Code from within the Debugger
Starting and Stopping the Debug Process
Setting Debugger Preferences
Customizing Colors and Fonts

Reference Information

Troubleshooting

Using Help



Bullet Overview
Bullet Viewing Local Variables
Bullet Changing the Value of a Local Variable
Bullet Tips
Bullet See Also

Line Graphic

Overview

The Local Variables view displays the names and values of variables and parameters local to the current stack frame. These variables are visible in the Local Variables view when program execution reaches the declaration of the variable. Each time program execution is paused, the values displayed in the view are updated and can then be modified. Global variables are not displayed in the Local Variables view but can be displayed in the Watch view.

Line Graphic

Viewing Local Variables

You can display variables in the Local Variables view when your program is paused. It is useful to observe the value of variables in a specific function to verify that the function is behaving as expected.

To view local variables

  1. In the main window, click the Local Variables tab. Parameters passed into the current function are listed first, followed by local variables declared within the current function.
  2. To expand an expression, click the plus sign (+) to the left of its name or double-click the line. To collapse an expression, click the minus sign (-) or double-click the line.

To see the Local Variables view in a separate window

  • Click the right mouse button, then click Open Separate View. The separate window behaves the same as the tabbed Local Variables view.
  • To close the separate window, click the right mouse button, then click Close.

    See Tips for a shortcut to opening a separate window.
NOTE: When you choose a stack frame from the Call Stack view, the Local Variables view displays the variables in that context. You can also view a variable that is not on the current stack from the Watch view.
Line Graphic

Changing the Value of a Local Variable

When the program is paused at a breakpoint or between steps, you can change the value of a numeric or pointer variable. The modified value replaces the current value in the program. This lets you try changes and see their results in real time or recover from certain logic errors.

To change a variable value

  1. In the Local Variables view, double-click the value you want to edit. A cursor appears in the Value field.
  2. Edit the variable's value.
  3. Press Enter to update the program with the modified variable value.

    See Tips in the Local Variables View reference topic for keyboard shortcuts.

    NOTES:
    • Press the Esc key to cancel the edit.
    • Character string pointers--You cannot change the content of the string, but you can change the address value to point to a string at a different memory address.
    • Character arrays -- You can edit the content of a character array, but there is no safeguard to prevent you from writing past the allocated array size. Also, the value must be entered inside double quotes.
Line Graphic

Tips

  • The value of a local variable is highlighted in red if it has changed in the current context since the last break in program execution.
  • Click the Local Variables toolbar button to open and close the Local Variables view in a separate window.
  • On the View menu, click Local Variables to quickly bring the Local Variables view to the top.
  • Keyboard shortcuts are available for moving in the Local Variables view and editing a value. See Tips in the Local Variables View reference topic.
Line Graphic

See Also

Line Graphic

Return to Top