原文链接:http://msdn.microsoft.com/en-us/library/windows/desktop/bb204634%28v=vs.85%29.aspx
本文链接:http://blog.csdn.net/wlsgzl/article/details/18717095
Users can configure automatic debugging to help them determine why their system or an application has stopped responding.用户可以配置自动调试器来帮助他们判断为何系统或者应用停止响应。
Configuring Automatic Debugging for System Crashes 为系统崩溃配置自动调试。
To configure the target computer to generate a crash dump file when the system stops responding, use the System application in Control Panel.想要配置目标计算机在系统不响应的时候生成一个崩溃转储文件,需要使用控制面板的系统应用。 Click Advanced system settings, which displays the System Properties dialog box. 点击高级系统设置,显示系统属性对话框。On the Advanced tab of that box, click Settings under Startup and Recovery, and then use the appropriate recovery options.在高级选项卡,点击设置启动和故障恢复,然后使用合适的恢复选项。 Alternatively, you can configure crash dump options using the following registry key:作为另一种选择,你可以使用下面的注册键配置崩溃转储选项。
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl
The file you can specify is the crash dump file. 你可以指定崩溃转储文件。Its default name is Memory.dmp.它的默认名是Memory.dmp。 You can debug a crash dump with a kernel-mode debugger, such as WinDbg or KD.你可以使用内核调试器例如WinDbg或者KD调试一个崩溃转储文件。 For more information, see the documentation included with the debugger.更多信息参照调试器的相关文档。
Configuring Automatic Debugging for Application Crashes 为应用程序崩溃配置自动调试
When an application stops responding (for example, after an access violation), the system automatically invokes a debugger that is specified in the registry for postmortem debugging, The process ID and event handle are passed to the debugger if the command line is properly configured. 当一个应用程序停止响应(例如访问违规之后)系统自动调用注册的指定调试器进行事后调试,如果命令行配置合理,进程ID和事件句柄会传递给调试器。The following procedure describes how to specify a debugger in the registry.下面的步骤阐述了如何在注册表里指定一个调试器。
To set a debugger as the postmortem debugger 设置一个事后调试器
1、Go to the following registry key:在下面的键:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
2、 Add or edit the Debugger value, using a REG_SZ string that specifies the command line for the debugger.添加或者编辑调试器的值,使用REG_SZ字符串来为调试器指定命令行。
The string should include the fully qualified path to the debugger executable. 字符串应该包含调试器执行文件的全部路径。Indicate the process ID and event handle with "%ld" parameters to the debugger command line. 用“%ld”为调试器的命令行指明进程ID和事件句柄。Different debuggers may have their own parameter syntaxes for indicating these values.不同的调试器可能有它们自己的语法来指明这些参数。 When the debugger is invoked, the first "%ld" is replaced with the process ID and the second "%ld" is replaced with the event handle.当调试器被调用的时候,第一个参数“%ld”表示进程ID,第二个“%ld”表示事件的句柄。
The following text is an example of how to setup up WinDbg as the debugger.下面的文本是一个设置WinDbg为调试器的例子。
"C:\debuggers\windbg.exe" -p %ld -e %ld -g
3、If you want the debugger to be invoked without user interaction, add or edit the Auto value, using a REG_SZ string that specifies whether the system should display a dialog box to the user before the debugger is invoked. 如果你想要无需人工干预的调用,使用REG_SZ字符串添加或者编辑自动值,指定系统是否需要在调试器调用的时候显示一个对话框给用户。The string "1" disables the dialog box; the string "0" enables the dialog box.“1”禁止对话框,“0”则允许。
Excluding an Application from Automatic Debugging 从自动调试中排除程序
The following procedure describes how to exclude an application from automatic debugging after the Auto value under the AeDebug key has been set to 1.下面的步骤描述了如何在AeDebug键的自动值设置为1的时候排除程序的自动调试。
To exclude an application from automatic debugging 排除程序的自动调试
1、Go to the following registry key:在下面的键中:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
2、Add a REG_DWORD value to the AutoExclusionList subkey, where the name is the name of the executable file and the value is 1. 在名字是执行文件名、值为1的地方给AutoExclusionList子键添加一个REG_DWORD的值。By default, the Desktop Window Manager (Dwm.exe) is excluded from automatic debugging because otherwise a system deadlock can occur if Dwm.exe stops responding (the user cannot see the interface displayed by the debugger because Dwm.exe isn't responding, and Dwm.exe cannot terminate because it is held by the debugger).默认地,桌面窗口管理器排除在自动调试之外,因为不这样,系统的一个死锁会引发Dwm.exe的停止响应(因为Dwm.exe不响应,所以用会看不到调试器的界面,Dwm.exe也不会终止因为它被调试器挂起了)。
Windows Server 2003 and Windows XP: The AutoExclusionList subkey is not available; thus you cannot exclude any application, including Dwm.exe, from automatic debugging.对于2003服务器和XP系统:AutoExclusionList子键不可用,因此不能从自动调试中排除任何程序,包括Dwm.exe。
The default AeDebug registry entries can be represented as follows:默认的AeDebug注册项的结构如下:
HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
AeDebug
Auto = 1
AutoExclusionList
DWM.exe = 1