ID: Q100426
4.00 4.01 MS-DOS kbtool kbcode kbbuglist kbfixlist
The information in this article applies to:
An attempt to display the local variables of an assembly language module created in Microsoft Macro Assembler (MASM) version 6.1 may fail. MASM displays one of the following messages when you attempt to display a local variable either in the command window or in the locals window:
CAN0030: Error: expression cannot be evaluated
-or-
CXX0030: Error: expression cannot be evaluated
The actual error message depends on the expression evaluator (C or C++)
CodeView is using at the time.
Apparently, this problem is caused by CodeView incorrectly initializing memory. It occurs only after certain programs run, particularly those that use extended memory. Because MASM 6.1 is a DOS-extended application, the error occurs when CodeView runs after the assembler.
At present, there are two methods to work around this problem.
-or-
- Calculate an offset from the base pointer (BP+<offset>) as
shown in the Locals window.
- Add a watch on the address of the variable (&<variable>).
- Type the command "? &<variable>" (without quotation marks) in
the Command window to display the address.
Enter the address in the address field of a Memory window to display the desired location.
Microsoft has confirmed this to be a problem in CodeView versions 4.0 and 4.01 for MS-DOS. This problem was corrected in CodeView version 4.1 distributed with Microsoft Visual C++ version 1.0 for Windows.
If you have Visual C++, use LINK version 5.5 and CVPACK version 4.1 from the Visual C++ package with CodeView version 4.1 to debug applications developed in MASM version 6.1.
You can use the Watch window to view global variables without any difficulties. The following code example illustrates the problem with local variables and allows you to experiment with the Memory window to watch the local variable. If you use CodeView to debug this application immediately after you start your computer or immediately after opening an MS-DOS window in Windows, the error does not occur. If you run CodeView after running MASM 6.1, it will not evaluate the local variable.
; Assembly options needed: /Zi
.model small .stack .data a WORD ?
.code mainproc PROC NEAR
.STARTUP
mov ax,30h
mov a, ax
mov ax, 0
call myproc
mov ax, a
.EXIT
mainproc ENDP
myproc PROC NEAR LOCAL loc:WORD
mov ax, 60h
mov loc, ax
mov dx, loc
mov a, dx
ret
myproc ENDP
END
Additional reference words: 4.00 KBCategory: kbtool kbcode kbbuglist kbfixlist KBSubcategory: CvwIss
Keywords : kb16bitonly
Version : 4.00 4.01
Solution Type : kbfix
Last Reviewed: September 17, 1997