葡萄架上的牵牛花

东拼西凑之东成西就
posts - 202, comments - 247, trackbacks - 10, articles - 0

Dr. Watson is basically a debugging tool.  When a program has an unhandled exception, Dr Watson will be automatically started by the system.  An unhandled exception means that the program itself doesn't specify what to do when the error occurs, and no other debuggers are installed and configured to handle the error.  There are two Registry entries that tell the system the debugger to use:

Hive: HKEY_LOCAL_MACHINE
Key: Software\Microsoft\Windows NT\CurrentVersion\AeDebug
Name: Debugger
Data Type: REG_SZ
Value: drwtsn32 -p %ld -e %ld -g

Hive: HKEY_LOCAL_MACHINE
Key: Software\Microsoft\Windows NT\CurrentVersion\AeDebug
Name: Auto
Data Type: REG_SZ
Value: 1

For the first entry, the value shown is the default for Dr Watson.  If another debugger is used, the value will be the path and options of that debugger.  The second value tells whether the debugger will start automatically (value of 1) or prompt the user first (value of 0).  When Dr. Watson runs, it not only stops the program that errored, it also generates a log file at C:\Documents and Settings\All Users\Documents\DrWatson by default (根据OS的不同,其位置和文件名是不同的,请看下面的详细说明), called drwtsn32.log, which contains a plethora of information.  This information is particularly useful to developers, but is difficult to decipher for users.  If a third party debugger is installed, and you want to make Dr. Watson the default again, simply run "drwtsn32.exe -i" to restore the above Registry entries.

NT2000中,要禁用 Dr. Watson,按照下列步骤操作

1.

单击单击运行,在框中regedit.exe,然后单击确定

2.

找到并单击以下注册表

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug

注意步骤 3 步骤 4 是可的;如果您要原使用 Dr. Watson 的默认设置,需要两个步骤

3.

单击 AeDebug ,然后单击注册表上的出注册表文件

4.

要保存的注册表文件入名称和位置,然后单击保存

5.

AeDebug

Windows 中,调试程序的注册表位于 AeDebug 中。默情况下,Dr. Watson 程序安装在 Windows 中,并配置用程序错误时运行(Auto 的数据值为 1)。认值为

名称 = Auto
= 字符串 (REG_SZ)
数据 = 1 0。(默认值为 1

名称 = Debugger
= 字符串 (REG_SZ)
数据 = drwtsn32 -p %ld -e %ld -g

注意数据 (drwtsn32 -p %ld -e %ld -g) Dr.Watson 有的。其他调试程序将具有它自己的和参数。

Dr. Watson log file. For Windows 2000 the Log file is located at: C:\Documents and Settings\All Users\Documents\Microsoft\Dr Watson. For Windows XP the log file is located at: C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson (MS KB Q308538说缺省保存在C:\Documents and Settings\All Users.WINNT\Application Data\Microsoft\Dr Watson,到底是哪里未确认). The file is typically named drwtsn32.log. For Windows NT the log file is located at C:\WinNT and the file is typically named drwatson.log.

User dump log file. For Windows 2000 the Log file is located at: C:\Documents and Settings\All Users\Documents\Microsoft\Dr Watson. For Windows XP the log file is located at: C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson. For Windows NT the log file is located at C:\Winnt. The file is typically named user.dmp.

以上的位置和Dump文件名可以在Dr WatsonGUI窗口中设置。

To bring up the "Dr Watson for Windows 2000" interface, click Start, Run, and type "drwtsn32" without the quotes.  This brings up a window with the following options to configure.

 

Log File Path (ログ ファイル パス)

Crash Dump (クラッシュ ダンプ)

Wave File WAVE ファイル)

Number of Instructions (インストラクションの数)

Number of Errors To Save (保存するエラー数)

Dump Symbol Table (ダンプ シンボル テーブル)

Dump All Thread Contexts (すべてのスレッド コンテキストをダンプ)

Append To Existing Log File (既存)

Visual Notification (メッセージ ボックスによる通知)

Sound Notification (音による通知)

Create Crash Dump File (クラッシュ ダンプ ファイルの作成)

 

这些设置值保存在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DrWatson\

For Win98 / WinME the executable is DRWATSON.EXE

For WinNT / Win2000 / WinXP the executable is DRWTSN32.EXE (although DRWATSON.EXE is provided for backwards compatability)

 

DrWatson.exe (used to do dump stack information when a program crashes)works for 16-bit windows applications and DrWtsn32.exe works for 32-bit applications in NT.

MS KB article:

For 98/Me: Q185837, Q275481

For NT/2K: Q188296

For XP: Q308538

得到Log后解读它也是一番学问, Dr WatsonGUI窗口自带的帮助文档有一些简单的说明,可作为初学者的参考。Dump的解读就更难了,

Feedback

# re: 华生医生(Dr. Watson)使用技巧摘要

5/9/2005 6:00 PM by 长天孤鹜
P.S.
若要使Dr Watson生成的Log中能包括出错函数的调用堆栈(很有用!),请在VC中指定生成COFF format或Both format的Debug Info,而不是缺省的Microsoft format。对于VC 6.0,可在Project Setting的Link - Debug处设定。VC和Dr Watson都是微软的东西,缺省值却不太兼容,也挺可笑的。

Post Comment

Title  
Name  
Url
Comment   
Protected by Clearscreen.SharpHIPEnter the code you see: