I found that using the x64 Debugging Tools to debug x86 applications on 64-bit windows can lead to all kinds of problems. I recently installed both the x64 as well as the x86 Debugging Tools side-by-side on my system, so I can use the x86 debuggers for 32-bit applications and this seems to solve all my problems. Setting up just-in-time debugging to use the x86 debugger for 32-bit applications and the x64 debugger for 64-bit applications can be done through using regedit.exe. On x64 versions of windows, the “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug” key is used for JIT debugging 64-bit applications and the “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug” key is used for 32-bit applications. This means you can set one to the x64 debugger and the other to the x86 debugger. Here’s is an example .reg file that does exactly this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
“Debugger”=”\”C:\\Program Files\\Debugging Tools for Windows (x64)\\windbg.exe\” -p %ld -e %ld -g”
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
“Debugger”=”\”C:\\Program Files (x86)\\Debugging Tools for Windows (x86)\\windbg.exe\” -p %ld -e %ld -g”
This sample file can be downloaded here.
In a previous post, I described how to create explorer integration for WinDbg. If you have both the x86 and the x64 Debugging Tools installed, you may want to be able to choose which debugger you open an application with. This can be achieve by creating two entries, one for the x86 debugger and one for the x64 debugger. Here is an example .reg file that does this:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg x86]
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg x86\command]
“IsolatedCommand”=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,\
46,00,69,00,6c,00,65,00,73,00,28,00,78,00,38,00,36,00,29,00,25,00,5c,00,44,\
00,65,00,62,00,75,00,67,00,67,00,69,00,6e,00,67,00,20,00,54,00,6f,00,6f,00,\
6c,00,73,00,20,00,66,00,6f,00,72,00,20,00,57,00,69,00,6e,00,64,00,6f,00,77,\
00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,77,00,69,00,6e,00,64,00,\
62,00,67,00,2e,00,65,00,78,00,65,00,22,00,20,00,2d,00,6f,00,20,00,2d,00,73,\
00,66,00,6c,00,61,00,67,00,73,00,20,00,30,00,78,00,38,00,30,00,30,00,33,00,\
30,00,32,00,33,00,33,00,20,00,2d,00,57,00,20,00,53,00,6b,00,79,00,4c,00,69,\
00,6e,00,65,00,64,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00
@=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,\
00,65,00,73,00,28,00,78,00,38,00,36,00,29,00,25,00,5c,00,44,00,65,00,62,00,\
75,00,67,00,67,00,69,00,6e,00,67,00,20,00,54,00,6f,00,6f,00,6c,00,73,00,20,\
00,66,00,6f,00,72,00,20,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,\
28,00,78,00,38,00,36,00,29,00,5c,00,77,00,69,00,6e,00,64,00,62,00,67,00,2e,\
00,65,00,78,00,65,00,22,00,20,00,2d,00,6f,00,20,00,2d,00,73,00,66,00,6c,00,\
61,00,67,00,73,00,20,00,30,00,78,00,38,00,30,00,30,00,33,00,30,00,32,00,33,\
00,33,00,20,00,2d,00,57,00,20,00,53,00,6b,00,79,00,4c,00,69,00,6e,00,65,00,\
64,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg x64]
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg x64\command]
“IsolatedCommand”=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,\
46,00,69,00,6c,00,65,00,73,00,25,00,5c,00,44,00,65,00,62,00,75,00,67,00,67,\
00,69,00,6e,00,67,00,20,00,54,00,6f,00,6f,00,6c,00,73,00,20,00,66,00,6f,00,\
72,00,20,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,28,00,78,00,36,\
00,34,00,29,00,5c,00,77,00,69,00,6e,00,64,00,62,00,67,00,2e,00,65,00,78,00,\
65,00,22,00,20,00,2d,00,6f,00,20,00,2d,00,73,00,66,00,6c,00,61,00,67,00,73,\
00,20,00,30,00,78,00,38,00,30,00,30,00,33,00,30,00,32,00,33,00,33,00,20,00,\
2d,00,57,00,20,00,53,00,6b,00,79,00,4c,00,69,00,6e,00,65,00,64,00,20,00,22,\
00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00
@=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,\
00,65,00,73,00,25,00,5c,00,44,00,65,00,62,00,75,00,67,00,67,00,69,00,6e,00,\
67,00,20,00,54,00,6f,00,6f,00,6c,00,73,00,20,00,66,00,6f,00,72,00,20,00,57,\
00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,28,00,78,00,36,00,34,00,29,00,\
5c,00,77,00,69,00,6e,00,64,00,62,00,67,00,2e,00,65,00,78,00,65,00,22,00,20,\
00,2d,00,6f,00,20,00,2d,00,73,00,66,00,6c,00,61,00,67,00,73,00,20,00,30,00,\
78,00,38,00,30,00,30,00,33,00,30,00,32,00,33,00,33,00,20,00,2d,00,57,00,20,\
00,53,00,6b,00,79,00,4c,00,69,00,6e,00,65,00,64,00,20,00,22,00,25,00,31,00,\
22,00,20,00,25,00,2a,00,00,00
(Note: these entries also add specific command-line options that I like to use – you can use regedit.exe to remove or change them to whatever you want).
This sample file can be downloaded here. If you installed my previous implementation of explorer integration, you may want to delete the “HKEY_CLASSES_ROOT\exefile\shell\WinDbg” key to remove it. Otherwise you’ll have three WinDbg options to choose from, two of which are duplicates and do exactly the same thing.


Leave a Comment