BUG: Visual Workbench Debugger May Not Break in a Constructor

ID: Q104636

1.00 1.50 WINDOWS kbtool kbbuglist

The information in this article applies to:

SYMPTOMS

The Visual Workbench debugger does not stop at the breakpoint in a constructor called when a global object is instantiated in a C++ program.

RESOLUTION

A possible workaround is to add an interrupt 3 call to force the debugger to break inside the constructor, and then begin debugging from the interrupt 3 call. The code would resemble the following:

  _asm int 3

Another workaround is to use the CodeView debugger with Visual C++ Professional Edition 1.0.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Visual Workbench debugger. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem does not occur in Microsoft Visual C++ 32-bit Edition, version 1.0.

MORE INFORMATION

The following sample program demonstrates the problem. To reproduce the problem in the Visual Workbench debugger, compile and link the sample as a QuickWin program or place the similar code in a Windows program. Then you can set a breakpoint on the cout statement and press F5.

Sample Code

#include <iostream.h>
class test{
      int a;
      public:
      test();
      };
 test::test(){
      a=0;
      cout<<"This is inside constructor"; //Set a breakpoint here.
      };

test dummy; test *ptr=new test; // This call should be fine.
void main()
{ }

Additional reference words: 1.00 1.50 KBCategory: kbtool kbbuglist KBSubcategory: WBDebug Keywords : kb16bitonly

Last Reviewed: July 23, 1997