FIX: Visual C++ Debugger Unable to Watch Base Class Members

ID: Q102212

4.10 | 1.00 4.10 MS-DOS | WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

An attempt to place a watchpoint on a base class member variable of a derived class may fail. Microsoft CodeView for MS-DOS, CodeView for Windows, and the Visual Workbench debugger may display one of the following messages in the Watch or Locals window:

   CXX0030: Error: expression cannot be evaluated

   +??? * = {...} which expands into the CXX0030 message

In CodeView version 4.1 for MS-DOS, expanding a local object in the Locals window may cause the debugging session to hang. However, expanding the local, static, global, or external object in the Watch window does not cause the debugging session to hang.

In CodeView version 4.1 for Windows or in the Visual Workbench version 1.0 debugger, expanding a local, static, global, or external object in the Locals or Watch window does not cause the debugging session to hang.

This problem does not occur in CodeView versions 4.0 and 4.01 for MS-DOS and Windows.

RESOLUTION

To work around this problem, modify the code to add a constructor for the base class. The comments in the code example below demonstrate this procedure.

STATUS

Microsoft has confirmed this to be a problem in CodeView version 4.1 for MS-DOS and Windows and the Visual Workbench version 1.0 for Windows. This problem was corrected in Visual Workbench 32-bit Edition version 1.1 and in CodeView version 4.25 for Win32s.

MORE INFORMATION

The following code example demonstrates this problem. The error occurs if you attempt to expand the local instantiation of Derived_from_Test or if you place the cursor on the local object "local_object" and press SHIFT+F9 to activate the QuickWatch window.

Sample Code

/*
 * Compiler options needed: none
 */ 

class Test { public:
   // To work around this problem, remove the comment from the
   // following line to define a default constructor.
   // Test() { }
   int test_int;
};

class Derived_from_Test : public Test { };

void main(void)
{
   Derived_from_Test local_object;
}

Additional reference words: 1.00 4.10 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: WBDebug CvwIss

Keywords          : kb16bitonly kbCodeView kbDebug kbide kbVC kbbuglist kbfixlist
Version           : 4.10   | 1.00 4.10
Platform          : MS-DOS WINDOWS
Solution Type     : kbfix

Last Reviewed: September 20, 1997