Microsoft KB Archive/104240

From BetaArchive Wiki

BUG: Can't Debug LibMain with VC++ Debugger

Q104240

1.00 1.50 WINDOWS kbtool kbbuglist ---------------------------------------------------------------------- The information in this article applies to: - The Microsoft Visual Workbench included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5 ---------------------------------------------------------------------- SYMPTOMS ======== When debugging a Windows dynamic-linked library (DLL) with the Visual Workbench debugger, the debugger will not step into LibMain. The Visual C++ (VC++) debugger also ignores any breakpoint inside LibMain. RESOLUTION ========== A possible workaround is to add an interrupt 3 call to force the debugger to break inside LibMain, and then begin debugging from the interrupt 3 call. The code would resemble the following: _asm int 3 The debugger stops at the statement. It is important to perform a "restart" of the debugger each time after the program is executed. The restart forces the debugger to reload the libraries when you begin debugging. Reloading the libraries causes LibMain() to be called. An alternative workaround is to use CodeView for Windows. CodeView performs correctly when breakpoints are set in LibMain. STATUS ====== Microsoft has confirmed this to be a problem in the Visual Workbench debugger in Visual C++ for Windows version 1.0. This problem does not occur if the DLL is loaded dynamically at run time using the Windows function LoadLibrary(). This problem also does not occur in Visual C++ 32-bit edition. MORE INFORMATION ================ To reproduce the problem, you can set a breakpoint in the SELECT.C sample program included in Visual C++. In VC++ 1.0 for Windows, this sample is located in C:\MSVC\SAMPLES\SELECT. Additional reference words: 1.00 1.50 KBCategory: kbtool kbbuglist KBSubcategory: VWBIss

Keywords : kb16bitonly
Issue type :
Technology :


Last Reviewed: December 22, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.