adplus是windbg下面附带的一个小工具:
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/adplus
ADPlus V7.0 is a total rewrite of ADPlus. ADPlus V7.0 is written in managed code, which allows us to easily add new features. ADPlus.exe keeps the basic functionality of ADPlus.vbs and adds some additional features. Also, there is a new companion called ADPlusManager, which extends ADPlus to a distributed environment like an HPC computer cluster.
ADPlus is included in Debugging Tools for Windows.
For ADPlus V7.0 documentation, see adplus.doc in the installation folder for Debugging Tools for Windows.
Adplus抓取Dump有三种方式:
一种是Hang模式
adplus -hang -pn Prs.exe -o c:/dump -quit /2/当进程进程运行时生成dump
二是Crash模式
adplus -crash -pn w3wp.exe -NoDumpOnFirst //同上,不对 first chance exceptions生成dump
三 使用配置文件
以给adplus指定配置文件,在某个特定的条件下生成dump file,并把dump file存在特定目录下
adplus -c myconfig.cfg -pn w3wp.exe
myconfig.cfg
<ADPlus>
<Settings>
<RunMode>crash</RunMode>
</Settings>
<PreCommands>
<Cmd> !load clr10/sos</Cmd>
</PreCommands>
<Exceptions>
<Option> NoDumpOnFirstChance </Option>
<Option> NoDumpOnSecondChance </Option>
<Config>
<!-- This is for the CLR exception -->
<Code> clr </Code>
<Actions1> Log </Actions1>
<CustomActions1> !clr10/sos.cce System.Runtime.InteropServices.COMException 1; j ($t1 = 1) ‘.dump /ma /u c:/dumps/exceptiondump.dmp;gn‘ ; ‘gn‘ </CustomActions1>
<ReturnAction1> GN </ReturnAction1>
<Actions2> Void </Actions2>
<ReturnAction2> GN </ReturnAction2>
</Config>
</Exceptions>
</ADPlus>
参考文档:
http://support.microsoft.com/default.aspx?scid=kb;zh-cn;286350
http://aloneplayer.spaces.live.com/blog/cns!C3CB6D654135F83D!422.entry?wa=wsignin1.0&sa=400828496
Adplus参数设置
-hang |
进程运行时,随时可以使用-hang参数得到一个Dump文件, 而不需要考虑线程是否真的处于死锁中,用于诊断高内存使用率, 高CPU使用率。 |
-crash | 在进程异常终止时抓取dump file. 进程异常终止有3种情况: 1.unhandled的exception 2.asp.net进程由于iis reset或recycle而终止. 3.出现heap毁坏,栈溢出,内存不足等错误,进程必须退出 |
-pn | 指定要分析的进程名。使用多个“-pn process name”开关来指定多个进程。 |
-o |
dump file的存储路径,缺省为adplus所在路径 |
-FullOnFirst | create full dumps on first chance exceptions |
-MiniOnSecond | |
-NoDumpOnFirst | 如果exception被try-catch block处理,使用这个参数就不会生成dump file |
-NoDumpOnSecond | |
-quiet | No dialog boxes will be displayed |
其他方法:
服务启动自动附加调试的方法:
在注册表:HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options
参考: http://support.microsoft.com/kb/824344/
https://blog.csdn.net/lxj434368832/article/details/79254236
http://www.cnblogs.com/lidabo/p/3706829.html
原文:https://www.cnblogs.com/youxin/p/10236693.html