Knowledge Base

FIX: __vfptr Elements Are Not Properly Displayed in Debugger

Article ID: 150003

Article Last Modified on 12/1/2003


APPLIES TO


This article was previously published under Q150003

SYMPTOMS

When you view the theApp variable in an AppWizard-generated MFC application, the element values of __vfptr are not properly displayed in the debugger. For an example, please see the "More Information" section of this article.

RESOLUTION

Drag the address of __vfptr into the memory window, view the data in long-hex format, and notice that the addresses to which the __vfptr variable points appear.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.

MORE INFORMATION

Example

  1. Create a default AppWizard MFC application. In the InitInstance(), view the theApp variable in the watch window.
  2. Expand the theApp variable to view the following tree structure:
       theApp
        CWinApp
         CWinThread
          CCmdTarget
           CObject
             __vfptr = 0x00405118   // This is correct
Under Windows NT:
          [0] CXX0030: Error: expression cannot be evaluated
          [1] CXX0030: Error: expression cannot be evaluated
          [2] CXX0030: Error: expression cannot be evaluated
          [3] CXX0030: Error: expression cannot be evaluated
          [4] CXX0030: Error: expression cannot be evaluated
				
Under Windows 95 (All values are incorrect):
          [0] 0xf000e681
          [1] 0xf000ff47
          [2] 0xf000ff47
          [3] 0xf000ff47
          [4] 0xf000ff47
				

Additional query words: kbVC400bug

Keywords: kbbug kbfix kbide kbvc500fix kbdebug KB150003