Chapter 7. Machine-level Debugging Windows

The Debugger offers three views useful in debugging at the machine level: the Disassembly View, Register View, and Memory View.

The Disassembly View Window

The Disassembly View window allows you to look at machine-level code rather than source-level code. A typical Disassembly View window is brought up by selecting Disassembly View from the Main View window menu bar.

Similarities with Main View Window

At the top of the window are the same process control buttons as those in the Main View window. They behave the same way except for Step Into and Step Over, which do machine-level instruction stepping instead of source-level. Remember that you can select the number of steps by holding down the right mouse button over the Step Into and Step Over buttons.

The Admin, Display, and Traps items on the menu bar basically work same as their counterparts in the Main View window.

The Disassemble menu is discussed in “The Disassemble Menu”. The Preferences selection from the Config menu is discussed in “The Config Menu Preferences Dialog”.

You can set traps either by using the Traps menu or by clicking in the annotation column to the left of the source display area that contains the disassembled code.

The Disassemble Menu

The Disassemble menu allows you to display disassembled code. It contains the following items:

  • Address: Allows you to disassemble a specified number of lines, starting from a specified source line address (see Figure 7-1).

    Figure 7-1. The Disassemble From Address Dialog

    The Disassemble From Address

  • Function: Allows you to disassemble a specified number of lines, starting from the beginning address of a specified function name.

  • File: Allows you to disassemble a specified number of lines, starting from the address corresponding to a specified line number in a specified file (refer to Figure 7-2). If you have a current selection in the Main View window or the Source View window, its file and cursor position are used as the default file name and line number, respectively.

    Figure 7-2. The Disassemble File Dialog

    The Disassemble File Dialog

The Config Menu Preferences Dialog

Selecting Preferences from the Config menu brings up the Disassembly View Preferences dialog box so that you can select the display preferences you desire.

The dialog box provides you with the following options:

  • Number of instructions to disassemble : Controls the default number of disassembly lines shown when the process stops. This number appears in the dialog boxes selected from the Disassemble menu. The default is all instructions, indicating that the entire function will be disassembled.

  • Minimum lines around current instruction : Controls the display of the disassembled code, enabling you to view at least the specified number of instructions before and after the current instruction.

  • Register name display format: Controls how register names are displayed. The available modes are Hardware, Compiler, and Assembler .

  • Show embedded source annotation : When ON, displays source and disassembly statements interleaved. When OFF, displays disassembly statements only.

  • Show source file and line number : Displays the filename and file position along with each machine instruction.

  • Show function name and line number ; Displays the function name and file position along with each machine instruction.

  • Show machine address: Displays the memory address of each machine instruction.

  • Show instruction value: Displays the instruction word along with each machine instruction.

  • Show jal targets numerically: Controls whether the target address of a jal instruction is displayed as a hex address or symbolic label.

  • Show supplemental address info (pixie, cord, original) : Displays additional address information. This may be used to set address breakpoints in the Main View command window for corded or pixified code.

The Register View Window

Register View window allows you to examine and modify register values. You bring it up by selecting Register View from the Views menu in the Main View window. Figure 7-3, shows a typical Register View window that has been resized to show all available registers.

The Register View window displays each register with its current value. A question mark (?) displayed immediately before a register value signifies that the value is suspect; it may not be valid for the current frame. This can occur if a register is not saved across a function call. A colored marker indicates that a register value has changed since the last time the process stopped.

Figure 7-3. The Register View Window

The Register View Window

The major features of the Register View window are the following:

  • Current register field: Identifies the currently selected register. You can switch to a different register by entering its name (either by hardware name or by alias) in this field and pressing Enter. You can also switch registers by clicking on the new register in the display area.

  • Current register value field: Shows the contents of the selected register. You can assign a new value to a register by entering either a literal or an expression into the Value field. You then click on the Modify button to change the value or press Enter.

  • Register display area: Shows the registers organized into four groups: general, special, floating, and double. Note that the general registers are identified by both their hardware and software names. For systems with 32-bit processors (O2s, for example), double precision registers represent a pair of floating-point registers. For systems with 64-bit processors (Origin2000s, for example), float registers are not displayed at all. Floating-point calculations are done in double precision registers.

Note: The special registers p0, p1, and p2 do not appear in Figure 7-3. These are used for instrumentation and appear only when instrumentation has taken place.

Changing the Register View Display

The Preferences selection in the Config menu allows you to change the Register View display. It brings up the Register View Preferences dialog box (see Figure 7-4).

The register display toggle buttons let you specify which types of registers are to be displayed by default.

Figure 7-4. The Register View Preferences Dialog

The Register View Preferences Dialog

The register formatting area allows you to select formats for any of the registers.

The default fields in the top row let you change defaults for the four major types, which are set as follows:

  • General registers -- hexadecimal

  • Special registers -- hexadecimal

  • Float registers -- floating point

  • Double registers -- floating point

The rows in the register formatting area let you change the modes for the individual registers.

The Memory View Window

The Memory View window allows you to examine and modify memory. A typical Memory View window appears in Figure 7-5.

Figure 7-5. The Memory View Window with the Mode Submenu Displayed

The Memory View Window with the 
 Mode Submenu Displayed

Viewing a Portion of Memory

To view a portion of memory, enter the beginning memory location in the Address field. You can enter the literal value or an expression that evaluates to an integer address. These address specifications must be in the language of the current process as indicated by the call stack frame. The syntax of this expression depends upon the language of the program. For example, you can enter 0x7fff4000+4 as the memory address when stopped in a C function or enter $7fff4000+4 as the equivalent for a Fortran routine. Press Enter while the cursor is in the field or click the View button to display the contents of that location and the subsequent locations in the display area. This also displays the contents of the first address in the Value field where it can be modified.

The memory display area shows the contents of individual byte addresses. The column at the left of the display shows the first address in the row. The contents at that address are shown immediately to its right, followed by the contents of the next seven byte locations. If you enlarge the Memory View window, you can see additional rows of memory.

Changing the Contents of a Memory Location

To change the contents of a memory location, you select the address to be changed, either by direct entry or by clicking on the byte value in the display area. You can enter a single value or a sequence of hex byte values separated by spaces (for example, 00 3a 07 b2) in the Value field. You can also enter a quoted string to change a consecutive range of values to the ASCII values of that string. Pressing Enter while the cursor is in the Value field or clicking the Modify button substitutes the new value(s) starting at the specified location.

Changing the Memory Display Format

The Mode menu allows you to change the format of the value field and byte locations to either decimal, octal, hex, or ASCII.

Moving around the Memory View Display Area

The four control buttons at the upper right of the window help you move around the display area. These buttons are:

  • Up: Moves displayed bytes up a single row.

  • Down: Moves displayed bytes down a single row.

  • Page UpP Moves displayed bytes upward by as many rows as are currently displayed.

  • Page Down: Moves displayed bytes downward by as many rows as are currently displayed.