Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This topic applies to:
Visual Studio Edition |
Visual Basic |
C# |
C++ |
J# |
Express |
No |
No |
Yes |
No |
Standard |
No |
No |
Yes |
No |
Pro/Team |
No |
No |
Yes |
No |
The debugger can correctly evaluate assembly-language expressions, with some restrictions. The syntax used for some assembly-language expressions differs from the syntax used in assembly-language development systems, such as the Microsoft Macro Assembler (MASM).
Memory Operators
Memory operators are unary operators that return the result of a direct memory operation. These operators are used mainly to debug assembly-language code.
{BY | WO | DW} address
The BY operator returns a short integer that contains the first byte at address. This operator simulates BYTE PTR.
The WO operator returns a short integer that contains the value of the word, two bytes, at address. This operator simulates the Microsoft Macro Assembler WORD PTR operation. The DW operator returns a long integer that contains the value of the first four bytes at address. This operator simulates DWORD PTR.
The x format specifier used in some of these examples causes the result to be displayed in hexadecimal.
Examples
To display the first byte at the address of the variable sum:
BY sumTo display the first word at the address of the variable
new_set:WO new_setTo display the doubleword at the address of sum:
DW sumTo display the byte pointed to by the EBP register with a displacement of 6:
BY ebp+6,xTo display the word pointed to by the stack pointer, the last word pushed onto the stack:
WO esp,xTo display the doubleword pointed to by the ESI register:
DW esi,x
Register Indirect
The debugger does not recognize brackets ([ ]) to indicate a memory location pointed to by a register. Instead, use the BY, WO, and DW operators to reference the corresponding byte, word, or doubleword values.
| MASM expression | Debugger expression | C++ expression |
|---|---|---|
|
|
|
|
|
|
|
|
|
Register Indirect with Displacement
To perform based, indexed, or based-indexed indirect mode operations with a displacement, use the BY, WO, or DW operators with the addition operator.
| MASM expression | Debugger expression |
|---|---|
|
|
|
|
|
|
|
|
Address of a Variable
Use the C address-of operator (&) instead of the MASM OFFSET operator.
| MASM expression | Debugger expression |
|---|---|
|
|
PTR Operator
Use type casts or the BY, WO, and DW operators with the address-of operator (&) to replace the assembly-language PTR operator.
| MASM expression | Debugger expression |
|---|---|
|
|
|
|
|
|
|
|
|
|
Assembly-Language Strings
Add the string format specifier ,s after the variable name.
| MASM expression | Debugger expression |
|---|---|
|
|
Because C strings end with a null (ASCII 0) character, the debugger displays all characters from the first byte of the variable up to the next null byte in memory when you request a string display. If you intend to debug an assembly-language program, and you want to view strings in the Watch window, you should delimit string variables with a null character. An easy way to view null-terminated or unterminated strings is by using the Memory window.
Array and Structure Elements
Prefix an array name with the address-of operator (&) and add the desired offset. The offset can be an expression, number, register name, or variable.
The following examples show how to do this for byte, word, and doubleword arrays.
| MASM expression | Debugger expression |
|---|---|
|
|
|
|
|
|