Making wdw the Default Debugger (WinNT)
From Open Watcom
In Windows NT and later you can set the "Auto Execute Debugger". This is the debugger that can be called from the task manager as well as the one that is attached to a crashed process. This document describes how to configure The Watcom Debugger for Windows (wdw) to do this.
This feature is buggy. A list of the bugs is below:
- Previous to vesion 1.6, the debugger would not attach to the process properly. You could not auctually debug the application, but closing the debuger would close the process it was attached to. In prerelease versions of 1.6 the debuger attaches to the process properly and you can trace, set break points, etc.
- This seems not to be the case in OW1.7 and OW1.9 anymore, at least in newer version of Windows like XP. The debugger attaches to the process but you will be stuck inbetween ntdll!DbgUiRemoteBreakin() and ntdll!DbgBreakPoint(). You are not really able to debug your code. Being not an expert in Windows Debugger API's I think you are stuck in the thread the debugger created to control the debuggee instead of the debuggee thread itself. There maybe some fixing needed to this problen. If so, then it would probably have to go mostly to the trap file std.dll around bld/trap/lcl/nt/c.
There may be some connection to this stuff in the wiki: 
- In all versions of OpenWatcom, when you attach to a running process at startup, the debugger is no longer an MDI application and all the windows that normally appear inside the debugger appear as windows on the desktop. The cause of the bug is unknown and being worked on.
- This is not really a bug but instead a misunderstood feature. So far I can see OpenWatcom doesn't have the -p pid -e exc infrastructure of MSVC debuggers. wdw uses instead only a pid (in dec, or in hex with prefix #) as the last parameter instead of an exe name to attach to a process. However there exists a (seemingly undocumented) switch /Popups (bld/wv/win/c/ntcmd.c,wincmd.c) which has a single char shortcut of /p (or -p). This /Popups behaves as it seems supposed to behave, it switches the watcom gui mode to SW_DETACHABLE_WINDOWS. And so you see many singled windows on your desktop. Don't know the initial intention for this switch, but in my opinion this is an internal programmer one to help in debugging the watcom gui system under Windows. You can use it under normal debugger sessions with an exe name too. It doesn't depend on attaching to a process. It's in there at least since commercial Watcom 10.6 from 1996.
Modifying the registry
The registry key that contains the debuging parameters is [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]. You must modify this key as below.
- Please keep in mind that under 64bit versions of Windows you may have to keep an eye on [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug] too if you encounter problems with the aforementiond key. There is some key remapping under the hood depending on what source process (32/64bit) from you are looking at these things.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug] "Auto"="0" "Debugger"="\"c:\\watcom\\binnt\\wdw.exe\" -p %ld -e %ld" "UserDebuggerHotKey"=dword:0000000
- You should replace the Debugger line with the following for OpenWatcom 1.9
- Open up the IDE.
- Open up the project in C:\watcom\samples\win\watzee\win32
- Compile the project
- open up a dos box and type cd C:\watcom\samples\win\watzee\win32
- run watzee.exe
- Hit CTRL+ALT+DEL to open up task manager.
- Locate the instance of watzee.exe you opened and right click on it.
- Select Debug.
The debugger is now opened.
This process was first described by Walter Briscoe in 2003.