zoukankan      html  css  js  c++  java
  • AdPlus

    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.

    Where to get ADPlus

    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使用率。
        在hang模式下,dump file是以非侵入方式被抓取的, 并没有中断线程, 因此不需要跟启动进程有相同的身份,在客户端调试服务器时,hang模式抓取dump file很有用。

    -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

    1. 指向 新建 ,然后单击 键 。 在注册表编辑器在左窗格,会注意到 新项 # 1 (新的注册表子项的名称) 中选择进行编辑。
    2. 键入 ImageName 替换 新项 # 1 ,然后按 Enter 键。

      请注意 ImageName 是进程的承载您要调试的服务的映像名称占位符。 是例如如果您要调试由具有 MyService.exe 作为图像名称的进程承载的服务,键入 MyService.exe 。
    3. 用鼠标右键单击在步骤 e 中创建注册表子项。
    4. 指向 新建 ,然后单击 字符串值 。 在注册表编辑器在右窗格,会注意到 新值 # 1 ,一个新的注册表项的名称选择进行编辑。
    5. 使用 debugger,替换 新值 # 1 ,,然后按 ENTER 键。
    6. 右键单击您在步骤 h, 调试程序 注册表项,然后单击 修改 。 编辑字符串 对话框。
    7. 在该 数值数据 文字框键入 DebuggerPath,然后单击 确定 。

      请注意 DebuggerPath 是调试器的完整路径,您要使用的占位符。 是例如如果您要使用 WinDbg 调试器调试服务,您可以键入类似于以下的完整路径:
      C:/Progra~1/Debugg~1/windbg.exe

    参考: http://support.microsoft.com/kb/824344/

    https://blog.csdn.net/lxj434368832/article/details/79254236

    http://www.cnblogs.com/lidabo/p/3706829.html

  • 相关阅读:
    【转】数据库分页Java实现
    【转】ibatis的简介与初步搭建应用
    response.setContentType()的作用及参数
    【转】mysql数据库中实现内连接、左连接、右连接
    【转】JAVA的StringBuffer类
    【转】Java学习之Iterator(迭代器)的一般用法 (转)
    函数装饰器
    闭包函数
    函数(2)
    函数(1)
  • 原文地址:https://www.cnblogs.com/youxin/p/10236693.html
Copyright © 2011-2022 走看看