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
- You must be debugging.
- On the View menu, choose Debug Windows and choose Disassembly.
To turn optional information on or off
- On the Tools menu, select Options.
- In the Options dialog box, choose the Debug tab.
- Under Disassembly window, select or clear the check boxes for the types of information to display:
- Source annotation
- Code bytes
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
In a source window, place the cursor on the line of source code you are interested in.
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
- Select the Disassembly window.
- On the Edit menu, choose Go To.
- Under Go to what, select Address.
- In the Enter address expression box, type or paste the address.
- Choose the Go To button.
To view assembly code for a specific address using drag-and-drop
- From another window, select a memory address or pointer variable containing a memory address.
- Drag the address or pointer to the Disassembly window, and drop it.
- 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.