Using the WDB GUI · Viewing Your Code 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
{short description of image} 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
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 Source Code
Bullet Viewing Assembly Code
Bullet Viewing Variables with Dwell
Bullet Tips
Bullet See Also

Line Graphic

Overview

The WDB GUI offers two main views for looking at your code: the Source view and the Disassembly view. Use the Source view to see the contents of a file, and use the Disassembly view to see the corresponding assembly code.

The dwell feature allows you to quickly view the value of a variable or expression. It is available from both the Source view and Disassembly view.Line Graphic

Viewing Source Code

Before you can view your source code, you must have an executable loaded and running in the WDB GUI. Once you have loaded a file, you can use the Source view to see and manipulate your source code. Specifically, you can use the Source view to:

  • See the current file's source path.
  • See the source file contents.
  • See the current location of the program counter. The program counter is set to the point in your program where the debugger will begin executing.
  • See the location and status of breakpoints.
  • See a stack marker that indicates the current context, determined by the stack frame selected in the Call Stack view.
  • Access the pop-up menu to perform actions that will affect how the code executes.
  • Use dwell to quickly view the value of a variable or expression.

To view your source code in the Source view

  1. In the main window, click the Source tab.
  2. View the file's source path by looking below the Source tab label.
  3. View the source code content in the right column of the Source view.
  4. View the location of the program counter, breakpoints, and the stack marker in the left column of the Source view.
NOTE: You cannot display the Source view in a separate window.

To use the pop-up menu in the Source view

  • In the Source view, click the right mouse button to display a pop-up menu that contains the following commands:
    • Show Next Statement
    • Quick Watch
    • Insert/Remove Breakpoint
    • Enable/Disable Breakpoint
    • Edit Breakpoint...
    • Run to Cursor
    • Set Next Statement
    • Edit File
    • Open File in $EDITOR

    See the Source View reference topic for descriptions of these commands.
Line Graphic

Viewing Assembly Code

Before you can use the Disassembly view, your executable must be running. You can use the Disassembly view to:

  • See the assembly code associated with the currently executing function.
  • See the instruction that corresponds to the current location of the program counter. The program counter is set to the point in your program where the debugger will begin executing.
  • See the location and status of breakpoints.
  • See a stack marker that indicates the current context, determined by the stack frame selected in the Call Stack view.
  • Access the pop-up menu to perform actions that will affect how the code executes.
  • Perform debug actions, such as stepping through a program and setting breakpoints.
  • Use dwell to quickly view the value of a variable, register, or expression.

To view code in the Disassembly view

  1. In the main window, click the Disassembly tab.
  2. View the assembly code content in the right column of the Disassembly view.
  3. View the location of the program counter, breakpoints, and the stack marker in the left column of the Disassembly view.

To see the Disassembly view in a separate window

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

To use the pop-up menu in the Disassembly view

  • In the Disassembly view, click the right mouse button to display a pop-up menu that contains the following commands:
    • Show Next Statement
    • Quick Watch
    • Insert/Remove Breakpoint
    • Enable/Disable Breakpoint
    • Edit Breakpoint...
    • Run to Cursor
    • Set Next Statement
    • Open Separate View
    • Close

    See the Disassembly View reference topic for descriptions of these commands.
Line Graphic

Viewing Variables with Dwell

The dwell feature displays the value of the variable or expression on which the mouse pointer is paused. Dwell works in both the Source view and the Disassembly view.

Dwell gives you quick information about a variable. For more detailed information, use Quick Watch, Watch view, or Local Variables view.

To view the value of a variable or expression

  1. Use the mouse to position the pointer over a variable. For an expression (such as a+b), highlight the expression to select it, then point to the highlighted text.
  2. Don't move the pointer. After a short time (about a half-second), a window appears that displays the value of the variable or expression.
  3. Move the mouse or press a key or button to close the dwell window.
  4. You can view the decimal and hexadecimal value of a numeric variable or expression by changing the preference in the Source View section of the Edit > Preferences dialog box. See Setting Debugger Preferences. The displayed decimal and hexadecimal values are separated by a semicolon(;)

Limitations of Dwell

Dwell does not display the value of certain types of variables and expressions. It will not display the value of complex variables such as arrays and structs, but it will display the value of elements in an array, fields in a struct, and pointers.

Expressions are not displayed if there may be a potential side effect on the program being debugged (such as i++ or exit(1)). Expressions containing ), =, ++, and -- are not displayed with dwell.

Examples with Complex Variables

Dwell displays the value of fields as well as variables. Dwelling on bar of foo->bar displays the value of foo->bar, while dwelling on foo displays only the value of foo.

In the expression a[i] there are several places to use dwell:

  • If a is a pointer, dwelling on a displays the value of variable a.
  • If a is an array, dwelling on a displays the text [...]. This indicates that the variable is an array and cannot be viewed with dwell. You can use dwell to view the value of individual elements within an array.
  • Dwelling on i displays the value of i.
  • Dwelling on [ displays the value of a[i].

In the expression *p, you can use dwell in the following ways:

  • Dwelling on the * displays the value of *p.
  • Dwelling on the p displays the value of p.
Line Graphic

Tips

  • Use the function browser to view source for a particular function. (See Browsing Functions for details.)
  • Click the Disassembly toolbar button to open and close the Disassembly view in a separate window.
  • On the View menu, click Source or Disassembly to quickly bring that view to the top.
  • You can customize the WDB GUI to display line numbers in the Source view. On the Edit menu, click Preferences and use the Display Line Numbers check box to set whether line numbers are displayed in the Source view.
Line Graphic

See Also

Line Graphic

Return to Top