div KenID:Kendiv
396842次访问,排名124好友0人,关注者2
Kendiv的文章
原创 155 篇
翻译 42 篇
转载 71 篇
评论 221 篇
Kendiv的公告
我们家最坏的就是他~~ 我的mimi,可爱吧~~
2008.08.22
Coding Life
/*---------------------
Personal Info:
Name: Kendiv
----------------------*/
最近评论
muchool:http://cvsproxy.muchool.com/ 专门针对软件开发人员量身定做的CVS代理下载,无需安装任何CVS客户端,轻松而快速的打包下载CVS版本控制服务器上的资源,自动剔除版本控制信息,还原开发者的原始项目目录.
ruanjian311:受益匪浅
mohroq:wow gold,
AloneSword:我喜欢 你家的 那个最坏的。
wanttocto:谢谢兄弟!!!
可以发一份中英文都有的给我吗?
xiao_17_xiao@126.com
文章分类
收藏
相册
AI
智能中国
AntiVirus
Malware-Research‏
AV Engine
a tool to collect malware
ClamAV for Windows
ClamAV Virus Database
ClamAV-Home
Disassembly Challenges
Filetype Detection - wiki
IceSword - Home
OpenAnti-Virus
BBS、论坛
Juniper Networks
Visual Studio Team System - 微软中文技术社区
ChinaUnix Blog
飞翔,嵌入式linux
Data Loss Prevention (DLP) Security
Hacker
Collection.Sites
Z0MBiE's HomePage
ICAP
ICAP-Forum
POSIX Threads(PThreads)
Open Source POSIX Threads for Win32
Squid
squid-home
Virtualization
虚拟机之家
Web Tech.
Https - wiki
ICP - Home
技术网站
absurd,大牛
ChinaUnix
Cisco Systems
CSDN
DDK MVP Expert Zone
Dr. Dobb's Journal
Ethereal
Kernel Mustard的专栏
Linux Journal
LinuxAid 技术支持中心
Microsoft Systems Journal
Microsoft TechNet
MSDN 技术资源库
MSDN中文WebCast
SysInternals(FreeWare)
The Code Project
VCHelp
VC在线
VC知识库
Windows Driver Programming(WD-3)
ZDNet China
中国协议分析网
哈工大·纯C论坛
安全焦点
微软中国社区
绿盟技术版
罗云彬的编程乐园
驱动开发网
其他
前程无忧
数字北京
清韵书院
铁血军事网
铁血读书
网上书店
China-Pub
第二书店
友情链接
JoyCode博客堂
Rong
嵌入式软件开发网(UCSDN)
狗狗
邹欣的Blog
存档
订阅我的博客
XML聚合  FeedSky

转载 Dr.Watson使用技巧摘要收藏

新一篇: ANT的安装/配置笔记 | 旧一篇: Open Source 开发工具集

Dr.Watson使用技巧摘要

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.

若要使Dr Watson生成的Log中能包括出错函数的调用堆栈(很有用!),请在VC中指定生成COFF format或Both format的Debug Info,而不是缺省的Microsoft format。对于VC 6.0,可在Project Setting的Link - Debug处设定。

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 Watson的GUI窗口中设置。

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.

在NT或2000中,要禁用 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 专有的。其他调试程序将具有它们自己的值和参数。


1.Dr.Watson是什么?
          Dr.Watson( drwtsn32.exe)是Windows自带的调试工具,相比于比较专业的程序调试工(WinDbg,Ntsd…)她显得比较的弱小,但是在如下场合她应该是比较好的一种选择:
a.       在没有安装任何调试工具的测试机器上我们的程序崩溃了.怎么办?是把Windows弹出来的报错的对话框抓屏发给开发人员看吗?说实话那个对话框对开发人员来说信息太少了,唯一能断定的是:哦,这个程序崩溃了.
b.       在最终用户的机器上;我们的程序已经发售到了最终用户手上,程序崩溃了,怎么办?问题出在哪?
在这个时候Dr.Watson显出了她的优势:她是Windows自带的调试工具,不需要另外安装,而且她能提供给开发人员必要的信息去确定问题 的所在.
这就是说Dr.Watson能在如下时刻帮助我们:
1.       应用程序崩溃了(Crash);
2.        应用程序遇到了异常(Exception)(注:产生了异常如果我们采取了一切措施,比如Try-Catch机制,并不会导致崩溃)
 
2.Dr.Watson什么时候会被运行起来?
           如果你的机器上Dr.Watson被设置成默认的调试工具那么当你的Windows中任何程序崩溃的时候Dr.Watson会自动运行,当然她的运行也许没有界面(可以在Dr.Watson界面中设置),她只是默默的产生了一个包含错误信息的文件存放在特定的路径下.这时候你要做的也许就是把这个包含错误信息的文件发给开发人员.注意我们前面说到的”如果Dr.Watson被设置成默认的调试工具那么….”也就是说Dr.Watson有可能并不是你机器上的默认的调试工具,比如说你安装了VC6++那么VC6++就会成为你的默认的调试工具….那如何把我们的Dr.Watson妹妹设置成默认的调试工具呢??请参看4.如何把 Dr.Watson设置成Windows默认的调试工具?
           另外一种运行Dr.Watson的方式就是在Run(运行)处输入drwtsn32回车.
 
3.当有程序崩溃的时候 Dr.Watson会产生什么文件?存在哪?
                 Dr.Watson产生的drwtson32.log,user.dmp文件,其中drwtson32.log是一个文本文件,大家随便找一个TextEdit就可以打开,里面包含的信息的解释稍后有详细的介绍,user.dmp文件是提供给WinDbg之类的稍专业一点的调试工具用的,WinDbg可以导入user.dmp文件然后看到崩溃的现场.
           文件的存放位置是可以在Dr.Watson中设置的,默认的存放位置和Windows的版本有关系:
Windows NT   :  %UserProfile%\Local Settings.
Windows 2000 : %AllUsersProfile%\Documents\DrWatson.
Windows 2003 : %AllUsersProfile%\Application Data\Microsoft\Dr Watson .
Windows XP   : %AllUsersProfile%\Application Data\Microsoft\Dr Watson .

4.如何把 Dr.Watson设置成Windows默认的调试工具?
                 Start(开始)àRun(运行),输入”drwtsn32 –i”回车,好了,现在Dr.Watson就是你的Windows的默认的调试工具了.
 
5.如何让 Dr.Watson只关心我指定的程序的崩溃情况?
                 大部分时间我们并不关心别的程序是否崩溃而只是关心我们正在测试/调试的程序,那我们能否让Dr.Watson只记录我们感兴趣的那个程序的崩溃情况呢??
                  在Run(运行)对话框中输入”drwtsn32 -p ProcessID”你就可以指定Dr.Watson只调试指定的进程. 

发表于 @ 2007年06月14日 01:02:00|评论(loading...)|编辑

新一篇: ANT的安装/配置笔记 | 旧一篇: Open Source 开发工具集

评论

#AloneSword 发表于2007-06-16 11:42:18  IP: 219.133.67.*
我喜欢 你家的 那个最坏的。
发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © Kendiv