用WinDbg分析Dump文件,转自WinDbg帮助文件

利用windbg分析程序崩溃生成的dmp文件 Windbg是一款功能十分强大的调试工具,它设计了极其丰富的功能来支持各种调试任务,包括用户态调试、内核态调试、调试转储文件、远程调试等等。 基本步骤: ●STEP 1:打开Windbg,在file中选择open crash Dump来打开所需要调试的Dump文件。 ●STEP 2:在file菜单中分别设置好Symbol file path 和 Source file path。 其中Symbol file path是程序编译时所生成的pdb文件,具体到某一个.pdb文件,如: ... 阅读详情

转自:http://blog.youkuaiyun.com/boythl/archive/2008/09/29/2991314.aspx

 

MS出的WinDbg是内核级调试利器,但我喜欢用它来调试客户端程序崩溃生成的Dump文件(运行状态生成Dump文件的方法可参见另一封转贴 http://blog.youkuaiyun.com/boythl/archive/2008/09/02/2868344.aspx). 

   Windbg中常用分析命令是: !analyze -v ,然后在分析结果里可以直接看到详细的调用堆栈; 另一个命令是: lmv ,该命令可以列举当前加载模板的详细数据.


   下文贴转自windbg的帮助文件; 第一部分是介绍,第二部分列举 !analyze 命令详解. 第三部分列举 lm 命令详解.

============================================================================

Analyzing a User-Mode Dump File with WinDbg

User-mode memory dump files can be analyzed by WinDbg. The processor or Windows version that the dump file was created on does not need to match the platform on which WinDbg is being run.

Installing Symbol Files

Before analyzing the memory dump file, you will need to install the symbol files for the version of Windows that generated the dump file. These files will be used by the debugger you choose to use to analyze the dump file. For more information about the proper installation of symbol files, see Installing Windows Symbol Files.

You will also need to install all the symbol files for the user-mode process, either an application or system service, that caused the system to generate the dump file. If this code was written by you, the symbol files should have been generated when the code was compiled and linked. If this is commercial code, check on the product CD-ROM or contact the software manufacturer for these particular symbol files.

Starting WinDbg

To analyze a dump file, start WinDbg with the -z command-line option:

windbg -y SymbolPath -i ImagePath -z DumpFileName 

The -v option (verbose mode) is also useful. For a full list of options, see WinDbg Command-Line Options.

If WinDbg is already running and is in dormant mode, you can open a crash dump by selecting the File | Open Crash Dump menu command or pressing the CTRL+D shortcut key. When the Open Crash Dump dialog box appears, enter the full path and name of the crash dump file in the File name text box, or use the dialog box to select the proper path and file name. When the proper file has been chosen, click Open.

You can also open a dump file after the debugger is running by using the .opendump (Open Dump File) command, followed with g (Go).

It is possible to debug multiple dump files at the same time. This can be done by including multiple -z switches on the command line (each followed by a different file name), or by using .opendump to add additional dump files as debugger targets. For information about how to control a multiple-target session, see Debugging Multiple Targets.

Dump files generally end with the extension .dmp or .mdmp. You can use network shares or Universal Naming Convention (UNC) file names for the memory dump file.

It is also common for dump files to be packed into a CAB file. If you specify the file name (including the .cab extension) after the -z option or as the argument to an .opendump command, the debugger can read the dump files directly out of the CAB. However, if there are multiple dump files stored in a single CAB, the debugger will only be able to read one of them. The debugger will not read any additional files from the CAB, even if they were symbol files or executables associated with the dump file.

Analyzing a Full User Dump File

Analysis of a full user dump file is similar to analysis of a live debugging session. See the Debugger Commands reference section for details on which commands are available for debugging dump files in user mode.

 

Analyzing Minidump Files

Analysis of a user-mode minidump file is done in the same way as a full user dump. However, since much less memory has been preserved, you are much more limited in the actions you can perform. Commands that attempt to access memory beyond what is preserved in the minidump file will not function properly.

Additional Techniques

For techniques that can be used to read specific kinds of information from a dump file, see Extracting Information from a Dump File.

 

 

Build machine: CAPEBUILD


===============================================

!analyze

The !analyze extension displays information about the current exception or bug check.

Syntax

User-Mode

!analyze [-v] [-f | -hang] [-D BucketID] 
!analyze -c [ -load KnownIssuesFile | -unload | -help ]

 

Kernel-Mode

!analyze [-v] [-f | -hang]  [-D BucketID] 
!analyze -c [ -load KnownIssuesFile | -unload | -help ]
!analyze -show BugCheckCode [BugParameters] 

 

 

 

Parameters
-v
Displays verbose output.
-f
Generates the !analyze exception output. Use this parameter to see an exception analysis even when the debugger does not detect an exception.
-hang
Generates !analyze hung-application output. Use this parameter when the target has experienced a bug check or exception, but a hung state analysis is more relevant to your problem. In kernel mode, !analyze -hang investigates locks that the system holds and then scans the DPC queue chain. In user mode, !analyze -hang analyzes the thread stack analysis to determine whether any threads are blocking other threads.

Before you run this extension in user mode, consider changing the current thread to the thread that you think has stopped responding (that is, hung), because the exception might have changed the current thread to a different one.

-D BucketID
Displays only those items that are relevant to the specified BucketID.
-show
Displays information about the specified bug check code.
-c
Continues execution when the debugger encounters a known issue. If the issue is not a "known" issue, the debugger remains broken into the target.

You can use the -c option with the following subparameters. These subparameters configure the list of known issues. They do not cause execution to occur by themselves. Until you run !analyze -c -load at least one time, !analyze -c has no effect.

-load KnownIssuesFile
Loads the specified known-issues file. KnownIssuesFile specifies the path and file name of this file. This file must be in XML format. You can find a sample file in the sdk/samples/analyze_continue subdirectory of the debugger installation directory. (You must have performed a full install of Debugging Tools for Windows to have this file. For more information about a full installation, see Debugger Installation.)

The list of known issues in the KnownIssuesFile file is used for all later !analyze -c commands until you use !analyze -c -unload, or until you use !analyze -c -load again (at which point the new data replaces the old data).

-unload
Unloads the current list of known issues.
-help
Displays help for the !analyze -c extension commands extension in the Debugger Command window.
BugCheckCode
Specifies the bug check code to display.
BugParameters
Specifies up to four bug check parameters. Separate these parameters with spaces. This parameter enables you to further refine your search.

 

DLL

Windows NT 4.0Ext.dll
Windows 2000Ext.dll
Windows XP and laterExt.dll

 

 

Comments

In user mode, the !analyze and !analyze -v extensions display information about the current exception.

In kernel mode, these extensions display information about the most recent bug check. If a bug check occurs, the !analyze display is automatically generated. You can use !analyze -v to show additional information. If you want to see only the basic bug check parameters, you can use the .bugcheck (Display Bug Check Data) command.

You can use the !analyzebugcheck -show extension command to display information about an individual bug check code. This display is not affected by the current status of the target computer.

The following example shows the results of !analyze after a breakpoint is hit.

0:000> !analyze
Last event: Hit breakpoint 10000

Additional Information

For sample analysis of a user-mode exception and of a kernel-mode stop error (that is, crash), and for more information about how !analyze uses the triage.ini file, see Using the !analyze Extension.

 

================================================

lm (List Loaded Modules)

The lm command displays the specified loaded modules. The output includes the status and the path of the module.

Syntax

lm Options [a Address] [m Pattern | M Pattern] 

Parameters
Options
Any combination of the following options:
o
Displays only loaded modules.
l
Displays only modules whose symbol information has been loaded.
v
Causes the display to be verbose. The display includes the symbol file name, the image file name, checksum information, version information, date stamps, time stamps, and information about whether the module is managed code (CLR). This information is not displayed if the relevant headers are missing or paged out.
u
(Kernel mode only) Displays only user-mode symbol information.
k
(Kernel mode only) Displays only kernel-mode symbol information.
e
Displays only modules that have a symbol problem. These symbols include modules that have no symbols and modules whose symbol status is C, T, #, M, or Export. For more information about these notations, see Symbol Status Abbreviations.
c
Displays checksum data.
1m
Reduces the output so that nothing is included except the names of the modules. This option is useful if you are using the .foreach token to pipe the command output into another command's input.

 

In addition, you can include only one of the following options. If you do not include any of these options, the display includes the symbol file name.

i
Displays the image file name.
f
Displays the full image path. (This path always matches the path that is displayed in the initial load notification, unless you issued a .reload -s command.) When you use f, symbol type information is not displayed.
n
Displays the image name. When you use n, symbol type information is not displayed.
p
Displays the mapped image name. When you use p, symbol type information is not displayed.
t
Displays the file time stamps. When you use t, symbol type information is not displayed.
a Address
Specifies an address that is contained in this module. Only the module that contains this address is displayed. If Address contains an expression, it must be enclosed in parentheses.
m Pattern
Specifies a pattern that the module name must match. Pattern can contain a variety of wildcard characters and specifiers. For more information about the syntax of this information, see String Wildcard Syntax.

Note  In most cases, the module name is the file name without the file name extension. For example, if you want to display information about the Flpydisk.sys driver, use the lm mflpydisk command, not lm mflpydisk.sys. In some cases, the module name differs significantly from the file name. For more information, see Executable Image Path.

M Pattern
Specifies a pattern that the image path must match. Pattern can contain a variety of wildcard characters and specifiers. For more information about the syntax of this information, see String Wildcard Syntax.

 

Environment

ModesUser mode, kernel mode
TargetsLive, crash dump
PlatformsAll

 

Comments

The lm command lists all of the modules and the status of symbols for each module.

Microsoft Windows Server 2003 and later versions of Windows maintain an unloaded module list for user-mode processes. When you are debugging a user-mode process or dump file, the lm command also shows these unloaded modules.

This command shows several columns or fields, each with a different title. Some of these titles have specific meanings:

  • module name is typically the file name without the file name extension. In some cases, the module name differs significantly from the file name. For more information, see Executable Image Path.
  • The symbol type immediately follows the module name. This column is not labeled. For more information about the various status values, see Symbol Status Abbreviations. If you have loaded symbols, the symbol file name follows this column.
  • The first address in the module is shown as start. The first address after the end of the module is shown as end. For example, if start is "faab4000" and end is "faab8000", the module extends from 0xFAAB4000 to 0xFAAB7FFF, inclusive.
  • lmv only: The image path column shows the name of the executable file, including the file name extension. Typically, the full path is included in user mode but not in kernel mode.
  • lmv only: The loaded symbol image file value is the same as the image name, unless Microsoft CodeView symbols are present. If CodeView symbols are present on Microsoft Windows NT 4.0, this value is the full path of the .dbg file.
  • lmv only: The mapped memory image file value is typically not used. If the debugger is mapping an image file (for example, during minidump debugging), this value is the name of the mapped image.

 

The following code example shows the lm command with a Windows Server 2003 target computer. This example includes the m and s* options, so only modules that begin with "s" are displayed.

kd> lm m s*
start    end        module name
f9f73000 f9f7fd80   sysaudio     (deferred)                 
fa04b000 fa09b400   srv          (deferred)                 
faab7000 faac8500   sr           (deferred)                 
facac000 facbae00   serial       (deferred)                 
fb008000 fb00ba80   serenum      e:/mysymbols/SereEnum.pdb/.......
fb24f000 fb250000   swenum       (deferred)                 

Unloaded modules:
f9f53000 f9f61000   swmidi.sys
fb0ae000 fb0b0000   splitter.sys
fb040000 fb043000   Sfloppy.SYS

 

 

WinDbg分析蓝屏dump原因 大多数人或许都经历过系统蓝屏问题,然而大多数人不清楚该怎么处理蓝屏问题,这里主要对系统蓝屏做一些解释,同时介绍下蓝屏问题分析工具WinDbg分析蓝屏问题的一般步骤。 微软官方对蓝屏的定义是,当系统遇到一些可能会威胁系统安全的情况时,系统会停止工作,这时的状态(即蓝屏)叫做Bugcheck, 即bug检查。 一般导致蓝屏的原因可能是:系统崩溃,系统内核出错,或者别的程序导致系统停止工作。 系统蓝屏其... 阅读详情

相关推荐

使用Windbg分析dump文件定位软件异常的方法!

1、前言 Windbg是微软开发的在Windows平台下强大的用户态和内核态调试工具,是Windows系统排查软件异常的一大利器,使用Windbg能极大的提高我们排查问题的效率,Windbg可以快速分析出软件崩溃、死循环、死锁等多种异常。 很多时候,如果仅仅通过排查代码或者添加打印去排查软件的异常崩溃,效率会很低,特别是代码量比较大的大项目,查起来会更加费劲。并且有些软件异常不是必现的或很难复现的,更不利于问题的排查。我们可以在工程代码中引入谷歌的CrashReport库,给软件安装异常捕获机制,当

肖邦的夜曲的专栏 1万+

WinDbg符号文件加载

WinDbg WinDbg符号文件加载 skyworth2010-07-02, 15:13 下午 pdb文件在d:\symcache根目录,但是始终无法加载,以下是windbg输出,为什么呢? iptsvr.pdb\8439F7A3C92A4014BCFD948DE875CD531\iptsvr.pdb 这个尤其奇怪,符号文件在symcache目录下 0:034> .relo

lixiangminghate的专栏 5280

使用WinDbg分析Windows dump文件方法

使用WinDbg分析Windows dump文件

jetliu05的博客 2万+

Crash Dump Analysis 崩溃转储分析-摘抄翻译自深入解析windows操作系统

崩溃转储分析

renluborenlubo的专栏 3063

使用Windbg分析dump文件的一般步骤及要点详解

通过一个问题实例详细讲解使用Windbg静态分析dump文件的完整过程。

dvlinker的技术专栏 4万+

如何让C++程序生成dump文件?生成dump文件的方式有哪些?如何使用Windbg分析dump文件?

本文详细介绍了如何让C++程序生成dump文件、生成dump文件的多种方式以及如何使用Windbg分析dump文件,并给出了对应的实战分析案例,有一定的实战参考价值。

dvlinker的技术专栏 5万+

windows程序使用Windbg分析dump

windows上Windbg分析dump文件

steem 9015

【C++软件实战问题排查经验分享系列 ④】pdb符号文件 | dump文件分类与生成方法 | Windbg分析dump文件 | Windbg动态调试 | Windbg常用命令 总结

在开发调试C++软件的过程中,时常会使用Windbg分析排查软件运行过程中遇到的各种异常问题。本文对使用Windbg涉及到的pdb符号文件、dump文件分类与生成方法、Windbg分析dump文件、Windbg动态调试目标进程、Windbg常用命令等诸多相关内容进行详细的总结,并给出相关的实战分析实例,供大家借鉴或参考。

dvlinker的技术专栏 3万+

WinDbg 蓝屏分析 Windows Dump 文件教程

修电脑最烦的不是别的,最烦的是 Random 蓝屏错误。因为你也不知道什么时候就蓝屏了。这种随机性还有无错误报告的问题最让人头疼。不过其实 Windows 每次蓝屏都会在系统目录下生成一个 Dump File 。也就是所谓分析报告。不过想要看懂这个报告,就需要一些技巧了。 一般来说,读取 Mini Dump 文件,只需要用 Nirsoft 的BlueScreenView即可轻松查看。不过这个软件只是轻量级的分析工具。只是给你提供崩溃时间,崩溃代码,引起崩溃的文件,崩溃内存地址等等。需要自己进行手动..

eli的博客 9万+

使用Windbg分析dump文件定位软件异常的方法与操作步骤

本文详细讲述了使用Windbg分析dump文件的一般步骤与诸多细节,并给出了一个实战分析实例,有一定的实战参考价值。

dvlinker的技术专栏 7万+

使用Windbg分析dump文件的一般步骤详解

使用Windbg静态分析dump文件是分析软件异常问题的常用方法,本文通过一个问题实例详细介绍使用Windbg静态分析dump文件的一般步骤及相关要点。

dvlinker的技术专栏 2万+

Windbg及Dump文件分析方法

1.WinDbg 1.1WinDbg介绍 WinDbg全称Debugging Tools for Windows,是windows平台下的调试工具。 获取Windbg的三种途径: (1)在Visual Studio安装时安装Windows Driver Kit(WDK)。WDK中包含WinDbg。 (2)安装Windows Software Development Kit (SDK)。SDK中包含WinDbg。下载地址 (3)如果只下载单独的WinDbg,先下载SDK,在安装过程中选择“Debu

mingjingtai2000的专栏 9199

使用Windbg分析dump文件,排查模态框返回时的崩溃问题

使用windbg分析dump文件,排查模态框返回时的崩溃问题。

dvlinker的技术专栏 4890

windbg分析dump文件

前言:WinDbg是微软开发的免费源代码级的调试工具。WinDbg可以用于Kernel模式调试和用户模式调试,还可以调试Dump文件。本文的讨论是在安装了Debugging Tools for Windows 的前提下进行的,下载地址可以参考我之前的文章。WinDbg对于dump文件的调试可以通过菜单设置Symbol File Path、Source File Path ,并可设置多个路径。 1

xiaoshahai的专栏 6万+

如何让C++程序自动生成dump文件?如何使用Windbg分析dump文件?

本文讲述如何让C++程序自动生成dump文件,以及如何使用Windbg分析dump文件。

dvlinker的技术专栏 9612

WinDbg分析dump文件

调试能力可以说是最重要,尤其对于C/C++程序员而言,更是如此! 当我们从测试那里拿到dump文件后,需要将对应的二进制文件(exe、dll等放到和出了问题的那台电脑同样的路径下) 1、用WinDbg打开dump文件 2、设置符号路径(生成二进制文件时对应的PDB文件,版本要一致!多个二进制文件的pdb最好生在同一目录): 3、设置源码路径(项目的solution路径,多个项目可以加到一个solution里面): 4、执行命令: !analyze -v 此时WinD.

Think88666的博客 8306
上一篇: Visual Studio 2010:C++0x新特性
下一篇: WinDbg配置和使用基础
UU_Yang
博客等级 码龄23年 926粉丝 213原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值