前言
崩溃系统上面的minidump需要快速定位崩溃点,由于量比较大,不可能人工一个个去看。秉着机械化的操作让机器去做的准则,调用windbg自带cdb来完成需求。完成的效果还不错,现在发出来让有同样需求的同学。
cdb是什么
cdb是windbg工具集里面的一个工具,可以用于命令行模式调用windbg来调试
微软的文档有说明
![v2-20ef38870667e71aeabbc54da52663b7_ipico.jpg](http://img-01.proxy.5ce.com/view/image?&type=2&guid=e5479aa4-3a2e-eb11-8da9-e4434bdf6706&url=https://pic4.zhimg.com/v2-20ef38870667e71aeabbc54da52663b7_ipico.jpg)
cdb [ -server ServerTransport | -remote ClientTransport ]
[ -premote SmartClientTransport ] [-log{a|au|o|ou} LogFile]
[-2] [-d] [-ddefer] [-g] [-G] [-hd] [-lines] [-myob] [-bonc]
[-n] [-o] [-s] [-v] [-w] [-cf “filename”] [-cfr “filename”] [-c “command”]
[-robp] [-r BreakErrorLevel] [-t PrintErrorLevel]
[ -x{e|d|n|i} Exception ] [-x] [-clines lines]
[-i ImagePath] [-y SymbolPath] [-srcpath SourcePath]
[-aExtension] [-failinc] [-noio] [-noinh] [-noshell] [-nosqm]
[-sdce] [-ses] [-sicv] [-sins] [-snc] [-snul] [-zp PageFile]
[-sup] [-sflags 0xNumber] [-ee {masm|c++}]
[-e Event] [-pb] [-pd] [-pe] [-pr] [-pt Seconds] [-pv]
[ – | -p PID | -pn Name | -psn ServiceName | -z DumpFile | executable ]
[-cimp] [-isd] [-kqm] [-pvr] [-version] [-vf] [-vf:] [-netsyms:{yes|no}]
cdb -iae
cdb -iaec KeyString
cdb -iu KeyString
cdb -QR Server
cdb -wake pid
cdb -?
本例子用到的命令如下:
-z dmp文件路径,如:”d:dumptest.dmp”
-y 符号路径,如:”srvf:symbolshttps://msdl.microsoft.com/download/symbols"
-c windbg的命令,如:”!analyze -v”
其他用法请参考微软文档。
python脚本
# -*- coding: UTF-8 -*-
直接用就能输出分析后的内容,首次加载符号表可能会有点慢请稍等。
python