• 【翻译 Windbg 4】Windbg 起步


    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html
    内部邀请码:C8E245J (不写邀请码,没有现金送)
    国内私募机构九鼎控股打造,九鼎投资是在全国股份转让系统挂牌的公众公司,股票代码为430719,为“中国PE第一股”,市值超1000亿元。 
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

    <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} h2 {mso-style-unhide:no; mso-style-qformat:yes; mso-style-link:"标题 2 Char"; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; mso-outline-level:2; font-size:18.0pt; font-family:宋体; mso-bidi-font-family:宋体; font-weight:bold;} a:link, span.MsoHyperlink {mso-style-unhide:no; color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} p {mso-style-unhide:no; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} span.2Char {mso-style-name:"标题 2 Char"; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"标题 2"; mso-ansi-font-size:18.0pt; mso-bidi-font-size:18.0pt; font-family:宋体; mso-ascii-font-family:宋体; mso-fareast-font-family:宋体; mso-hansi-font-family:宋体; mso-bidi-font-family:宋体; mso-font-kerning:0pt; font-weight:bold;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1864778569; mso-list-template-ids:389324362;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

    原文

    http://blogs.msdn.com/johan/archive/2007/01/11/how-to-install-windbg-and-get-your-first-memory-dump.aspx

    作者

    tess

    翻译

    AloneSword

    译文

    http://blog.csdn.net/alonesword/

     

     

    如何安装 windbg 与获取第一个转储文件

    安装 windbg

    Windbgasp.net 支持工程师必备的一种工具,它是免费的,可以在

    www.microsoft.com/whdc/devtools/debugging/default.mspx获得下载版本。本教程只是讲解了很少的一部分内容,但是如果你对应用程序背后所运行的内容感兴趣的话,那么windbg 就是你最好的朋友。关于如何配置windbg 应用程序,请链接到相应的文档进行查看,特别值得一提的是关于符号章节的内容。

    另外,如果想使用sos的扩展命令的话,可以在framekwork的安装目录中找到该文件,就framework 2.0 来说,该文件位于“c:/Windows/Microsoft.Net/Framework/v2.0.50727”,也可以将该文件拷贝到windbg所在目录,以便更好的访问。

    获取一个内存转储

    Windbg 既可在内存转出中进行分析,也可以附加到一个执行进程中进行分析。我主要处理内存转储,因为它更容易从用户哪儿获得,而不是访问服务器。我可能在其他的文章中谈论一下关于轻量级调试工具的内容,但是这里我们只谈论内存文件转储分析。

    Vista

    如果你的系统运行在window vista上,可以简单的通过任务管理器来创建一个转储文件。简单的打开“进程”列表,在你需要的进程上右键,选择“创建转出文件”即可。

    Adplus

    对于其他的系统,如果需要创建指定条件的转出文件,我推荐你使用脚本文件 adplus。它是随着windbg安装的,并且是可以从命令行中运行的。Adplus也可以使用一定的参数,但是对于基础的操作,有两件事情需要注意:

    1.  何时获取转储文件

    2.  需要转储的进程的id 或 名称

    通过adplus 获得的转储文件将会存储到windbg安装目录的子级目录中。

    例如:

    Adplus -crash -pn w3wp.exe

    运行该命令可以在任何一个命名为 w3wp.exe 的进程被终止或被回收时,形成一个完整的转储文件。通过如下命令,也可以创建一个在第一次异常发生时得到最小转储文件。

    Adplus -crash -pn  w3wp.exe -NoDumpOnFirst

    像上面一样,但不是最小转储文件:

    Adplus -hang -p 2960

    这个命令会立即得到一个关于进程ID 2960的完整转储文件,该命令一般用在进程被挂起或无响应时,记住这个名字。

    高级Adplus

    假设想定位到一个特定的异常,就可以使用一个配置文件。如下是一个实例,它将在发生System.Runtime.InteropServices.COMException 时得到一个完整的内存转储文件,只需要拷贝如下的代码到记事本中,保存为MyConfig.cfg

    <adplus>

    <Settings>

    <RunMode>CRASH</RunMode>

        </Settings>

        <PreCommands>

            <cmd>!load clr10/sos.dll</cmd>

        </PreCommands>

        <Exceptions>

            <Option>NoDumpOnFirstChance</Option>

            <Option>NoDumpOnSecondChance</Option>

        <Config>

            <!-- This is for the CLR exception. -->

            <Code>clr</Code>

                <Action1>Log</Action1>

                    <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>

                    <ReturnActions>GN</ReturnAction2>

        </Config>

        </Exceptions>

    </adplus>

    如您所见,只需要简单的调整一下配置文件,就可以得到其他异常信息的转储文件。转储文件存储在c:/dumps文件夹下,同时必须保证该文件夹存在。当你准备好后,就需要简单的运行如下语法的命令:

    Adplus -c myconfig.cfg -pn w3wp.exe

    通过终端会话调试系统

    如果你无法直接访问服务器,你要么通过附加非入侵方式,要么定制命令的计划任务。这些看起来有点复杂,但是在如下这篇知识库文章中描述了完整详细的描述了制作方法: http://support.microsoft.com/default.aspx/kb/323478

    我想这就是现在所有的内容了。

    /Johan

    关键字:windbg, adplus, Debugging School,Asp.net

     

  • 相关阅读:
    python 安装包总结
    python wmi使用
    Jquery
    查看linux操作系统位数
    三元
    git clone 指定分支的内容
    慕课网
    http://amazeui.org 后天框架
    tp between
    git pull
  • 原文地址:https://www.cnblogs.com/AloneSword/p/2237524.html
Copyright © 2020-2023  润新知