The information in this article applies to:
SUMMARYDebugging Win32-based applications under Windows 3.1 with Win32s can be difficult because the debugging tools are complex to use and the process is not well documented. This article presents several strategies and choices for debugging Win32s applications. Note that you can not use any 16-bit debuggers to debug a Win32s application, even if the Win32s application is thunking down to the 16-bit side using Universal Thunks.
MORE INFORMATIONBefore you start to debug a Win32-based application under Win32s, make sure that it runs correctly under Windows NT. Use either the WinDbg or NTSD debugger that ships with the Win32 Software Development Kit (SDK) or the Visual C++ debugger, to track down any problems. 1. Use the Debugging Libraries for Windows 3.1 and Win32sFirst install the debugging libraries for Windows 3.1 and run Windows. Note that the D2N.BAT and N2D.BAT files shipped with Windows 3.1 Software Development Kit (SDK) or Visual C++ 16-bit Edition version 1.5x compilers provide a way to switch between the retail and debug kernels of Windows. For more information on installing the Windows 3.1 debugging libraries, please refer to the following article in the Microsoft Knowledge Base:
From a Windows MS-DOS box, install the debug version of Win32s by using the SWITCH.BAT file shipped with your Win32s product. Run the W32SDBWIN.EXE application that is shipped with Win32s, and choose the appropriate Win32sDebug trace flags carefully (or set the Win32sDebug flags appropriately in the WIN.INI file). Note that selecting too many will generate more information than you may care to see and selecting too few may cause you to miss important information and warnings. Run the DBWIN debug application to capture the diagnostic trace output from Windows and Win32s debugging libraries. 2. Use CodeView for Win32s (if available)If you have Microsoft Visual C++ 32-bit Edition version 1.0, CodeView for Win32s (CVW32S.EXE) is an additional option. CodeView for Win32s is a user-level debugger. Remote debugging is not necessary, therefore, CodeView for Win32s does not require a second machine. CVW32S does not come with Visual C++ 2.0 and later, it is available only with Visual C++ version 1.0. You can still use CVW32S.EXE with later versions of Visual C++, if you link with /PDB:none and /INCREMENTAL:no and if you do not use new features such as templates or C++ exception handling. 3. Remotely Debug the Win32s Application Using Remote WinDBGIf the debugging libraries described in option 1 above do not help you track down the problem in your Win32-based application, you will have to debug your application under a 32-bit debugger. Unfortunately, there is no 32-bit debugger that works under Win32s except for CodeView for Win32s described above.
4. Remotely Debug the Win32s Application Using the Visual C++ DebuggerYou can also remotely debug your Win32-based application using the Remote Debug Monitor tool (MSVCMON.EXE) that only ships with the Win32s files that are included with Visual 32-bit Edition versions 2.x and 4.x. In this method, the MSVCMON.EXE runs on the target Win32s machine while communicating with the Visual C++ debugger running on the host Windows NT machine. The Visual C++ controls the execution of the Win32-based program you are debugging on your target machine.
5. Use a Low-level Debugger like WDEB386 that Ships with WindowsWDEB386 is a powerful system-level debugger that can be used for debugging Win32-based applications, but the tool and the method are complicated to use. In general, use this method under Win32s only if you have to debug a Win32-based application that implements Universal Thunks. Application-level debuggers, such as the Microsoft Visual C++ debugger, CodeView for Windows, and WinDBG, cannot trace through thunks because they consist of both 32-bit and 16-bit code.
REFERENCESYou can use most of the information provided in this article for debugging Win32s applications that implement Universal Thunks. For additional information on thunks, refer to the following article in the Microsoft Knowledge Base:
For general information on debugging under Win32s, please see the "Win32s Programmer's Reference" that is included with the Win32 SDK. Additional query words: Keywords : kbprg kbtool kbWin32s kbThunk Version : 1.25 1.30 1.30a 1.30c Platform : WINDOWS Issue type : kbhowto |
Last Reviewed: September 11, 1999 |