Using the Disassembly Window

The Disassembly window shows assembly code corresponding to the machine instructions created by the compiler. For each instruction, it shows the memory address where the instruction is located. In addition, it can show the following optional information:

  • Source annotation (comments showing the source code from which the assembly code derives)
  • Code bytes (byte representations of the actual machine-code instructions)
  • Symbols (symbolic names for addresses)
  • Injected source (source code injected by attributes)

When you view code in the Disassembly window, a yellow arrow in the left margin shows the location of the program counter, also known as the current location. It marks the next instruction that will be executed in your program.

To open the Disassembly window

  1. You must be debugging.
  2. On the View menu, choose Debug Windows and choose Disassembly.

To turn optional information on or off

  1. On the Tools menu, select Options.
  2. In the Options dialog box, choose the Debug tab.
  3. Under Disassembly window, select or clear the check boxes for the types of information to display:
    • Source annotation
    • Code bytes
    • Symbols

You can use the Disassembly window to look at the assembly-language code corresponding to a line of code in a source window.

To view assembly code for a specific line of source code

  1. In a source window, place the cursor on the line of source code you are interested in.

  2. Right-click on the source window and choose Go To Disassembly from the shortcut menu.

    The Disassembly window appears, if it was not already visible, and displays the assembly code corresponding to the line you selected.

You can use the Disassembly window to look at the assembly-language code at a specified address. You have your choice of two methods.

To view assembly code by typing or pasting a memory location

  1. Select the Disassembly window.
  2. On the Edit menu, choose Go To.
  3. Under Go to what, select Address.
  4. In the Enter address expression box, type or paste the address.
  5. Choose the Go To button.

To view assembly code for a specific address using drag-and-drop

  1. From another window, select a memory address or pointer variable containing a memory address.
  2. Drag the address or pointer to the Disassembly window, and drop it.
  3. When you view code in the Disassembly window, you can use the vertical scrollbar to move up or down in the memory space. The higher addresses appear at the bottom of the window. To view a higher address, you must move down, not up.