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只调试指定的进程.

Dr.Watson使用技巧摘要,布布扣,bubuko.com

时间: 2024-08-06 12:18:42

Dr.Watson使用技巧摘要的相关文章

《软件调试的艺术》学习笔记——GDB使用技巧摘要

<软件调试的艺术>学习笔记——GDB使用技巧摘要 <软件调试的艺术>,因为名是The Art of Debugging with GDB, DDD, and Eclipse. 作者是美国的Norman Matloff和Peter Jay Salzman,中文版由张云翻译.是人邮出版社图灵程序设计丛书初版.这里称为"艺术",个人觉得有点过了,但是其中关于gdb以及在gdb基础之上集成的DDD和Eclipse调试技巧的整理确实是做的很好,对于Linux/开源社区下的

计算机常识 和 应用技巧

8.恢复硬件以前的驱动程序 在安装了新的硬件驱动程序后发现系统不稳定或硬件无法工作时,只需在"设备管理器"中选择"驱动程序恢复"按钮,即可恢复到先前正常的系统状态.但不能恢复打印机的驱动程序. 9.自动登陆 单击开始→运行,输入"rundll32netplwiz.dll,UsersRunDll"(不带引号),然后在UserAccounts中取消"Usersmust enterausernameandpasswordtousethisco

释放C盘空间的27招优化技巧

主要讲讲Windows操作系统在C盘空间不足的情况下,我们可以通过那些具体手段来增加C盘空间. 1.打开"我的电脑"-"工具"-"文件夹选项"-"查看"-在"显示所有文件和文件夹"选项前打勾-"确定" 2.删除以下文件夹中的内容: x:\Documents and Settings\用户名\Cookies\下的所有文件(保留index文件) x:\Documents and Settin

通往WinDbg的捷径

通往WinDbg的捷径(一) 原文:http://www.debuginfo.com/articles/easywindbg.html译者:arhat时间:2006年4月13日关键词:CDB WinDbg 导言你钟情什么样的调试器?如果你问我这个问题,我会回答是“Visual Studio + WinDbg”.我比较喜欢Visual Studio那朴实无华且易操作的接口,更喜欢它能迅速把我需要的信息以可视的形式展示出来.但遗憾的是,Visual Studio调试器无法获取某些信息.例如,假设我想

逆向工程部分

六.逆向工程 (一)对抗反汇编 1.反汇编算法: (1)线性反汇编算法: 遍历代码段,一次一条指令的先行反汇编,用已经反汇编的指令大小来决定下一个要反汇编的字节,而不考虑代码流的控制指令. 不能区分代码与数据,最容易被恶意代码挫败 (2)面向代码流的反汇编算法: 检查每一条指令,然后建立一个需要反汇编的地址列表,而不是盲目的反汇编整个缓冲区,也不假设代码段中仅包含指令而不包含数据 2.对抗反汇编技术 (1)相同目标的跳转指令 使用指向同一目的地址的两个连续条件跳转指令,如: jz  loc_00

[经验] 系统封装常见问题大总结(非官方)

玩看 发表于 2013-6-21 20:25:22 https://www.itsk.com/thread-277947-1-1.html 哈哈,好久没来天空了,没办法,忙着应付高考,现在有空了,上来论坛瞧瞧,唬唬,原先的 XP系统封装视频教程大放送 居然因为7天内无回复而被锁帖,哎,都怪115网盘,都怪这破电信,上传速度那么慢,不然的话我就重传了.废话不多说,旧的不去新的不来,现在发布一篇新帖,当初因为看到经常有朋友问些低级问题,而这些问题天空又没有一篇较为完善的总结,为此咬咬牙,从论坛上搜集

Windbg(2)

摘抄于:http://www.cnblogs.com/awpatp/category/228209.html Debug相关的一些小技巧 摘要: 1. 如何Debug一个进程的子进程? 答: 使用WinDBG attach到父进程, 然后输入命令".childdbg 1"(无引号). 这样子进程在刚刚被加载的时候, WinDBG就Attach上去了. 这两个进程的debug session都在一个WinDBG的窗口里, 如果想要切换当前进程, 可以使用命令"|"来查

system32下 exe文件作用

system32下EXE文件的作用说明 A accwiz.exe 辅助功能向导 ahui.exe 应用程序兼容用户界面 alg.exe 为 Internet 连接共享和 Internet 连接防火墙提供第三方协议插件的支持 append.exe 打开指定文件夹中的数据文件 arp.exe 显示和修改“地址解析协议”(ARP) 所使用的到以太网的 IP 或令牌环物理地址翻译表 asr_fmt.exe 自动恢复系统 asr_ldm.exe 逻辑磁盘管理器ASR功能 asr_pfu.exe 自动系统恢

转载:.NET Memory Leak: XmlSerializing your way to a Memory Leak

原文地址:http://blogs.msdn.com/b/tess/archive/2006/02/15/532804.aspx I hate to give away the resolution in the title of the blog since it takes away a lot of the suspense:) but I can't figure out a better way to name the blog posts and still keep them ni