Joh*_*ing 69
以下是一些可以帮助您的一般步骤:
首先,您必须更改编译器的设置,以便创建PDB文件,即使对于发布版本也是如此.Visual C++编译器的更高版本默认执行此操作,但在许多版本的Visual C++中,您必须自己执行此操作.创建程序数据库文件,然后保存这些文件的存档以及应用程序的每个版本.至关重要的是,应用程序的每个构建都有自己的一组PDB.例如,您不能仅仅使用与构建10相同的方法来检查构建15生成的转储.在项目的整个生命周期中,您最终会得到大量的PDB,因此请做好准备.
接下来,您需要能够识别生成转储文件的应用程序的确切版本.如果您正在创建自己的MiniDump(例如,通过调用MiniDumpWriteDump()),最简单的方法是简单地将MiniDump的部分文件名作为应用程序的完整版本号.您需要有一个合理的版本编号方案才能实现.在我的商店中,每次autobuilder创建构建时,我们将所有分支的构建号递增1.
现在您已收到客户的转储文件,您知道创建转储的应用程序的精确版本,并且您已找到此版本的PDB文件.
现在,您需要查看源代码管理的历史记录,并找到该软件的确切版本的源代码.执行此操作的最佳方法是在每次构建时将"标签"应用于分支.将标签的值设置为确切的版本号,并且在历史记录中很容易找到.
你几乎准备启动WinDbg/Visual C++:
c:\app_build_1.0.100应用程序版本1.0 build#100.现在您有两个查看转储文件的选项.您可以使用Visual Studio或WinDbg.使用Visual Studio更容易,但WinDbg更强大.大多数情况下,Visual Studio中的功能就足够了.
要使用Visual Studio,您所要做的就是打开转储文件,就像它是一个项目一样.打开后,"运行"转储文件(F5默认情况下),如果所有路径都设置正确,它将直接转到崩溃的代码,给你一个调用堆栈等.
要使用WinDbg,你必须跳过几个环节:
.symfix.这可能需要一些时间,因为它会从互联网上拉下大量的东西..sympath+ c:\pdblocation,替换将PDB文件放在路径名的任何位置.确保你得到的加号,在那里与之间没有空格.sympath的和+标志,否则你会搞砸了第3步..srcpath c:\app_build_1.0.100替换您从源代码管理获取代码的路径,以获取此版本的软件.!analyze -v片刻之后,如果所有内容都配置正确,WinDbg会将您带到崩溃的位置.在这一点上你有深挖应用程序的内存空间,关键部分,Windows等的状态万股期权但是,这是方法超出了本文的范围.
祝好运!
Col*_*ith 34
(see the "Dump" sections below)
Understanding how Workspaces work...
A "cmdtree" allows you to define a "menu" of debugger commands for easy access to frequently used commands without having to remember the terse command names.
You don't have to put all the command definitions into the same cmdtree text file....you can keep them separate and load multiple ones if you wish (they then get their own window).
You can use the -c option on the command line to automatically run a WinDBG script when you start WinDBG.
Gives opportunity to turn on DML (Debugger markup language) mode, load particular extensions, set .NET exception breakpoints, set kernel flags (e.g. when kernel debugging you might need to change the DbgPrint mask so you see tracing information....ed nt!Kd_DEFAULT_Mask 0xffffffff), load cmdtrees, etc.
示例脚本:
$$ Include a directory to search for extensions
$$ (point to a source controlled or UNC common directory so that all developers get access)
.extpath+"c:\svn\DevTools\WinDBG\Extensions"
$$ When debugging a driver written with the Windows Driver Framework/KMDF
$$ load this extension that comes from the WinDDK.
!load C:\WinDDK\7600.16385.1\bin\x86\wdfkd.dll
!wdftmffile C:\WinDDK\7600.16385.1\tools\tracing\i386\wdf01009.tmf
$$ load some extensions
.load msec.dll
.load byakugan.dll
.load odbgext.dll
.load sosex
.load psscor4
$$ Make commands that support DML (Debugger Markup Language) use it
.prefer_dml 1
.dml_start
$$ Show NTSTATUS codes in hex by default
.enable_long_status 1
$$ Set default extension
.setdll psscor4
$$ Show all loaded extensions
.chain /D
$$ Load some command trees
.cmdtree c:\svn\DevTools\WinDBG\cmdtree\cmdtree1.txt
.cmdtree c:\svn\DevTools\WinDBG\cmdtree\cmdtree2.txt
$$ Show some help for the extensions
!wdfkd.help
!psscor4.help
.help /D
Run Code Online (Sandbox Code Playgroud)
"Extensions"允许您扩展WinDBG中支持的命令/功能范围.
这是一个非常广泛的问题。
!analyze -v以对其执行基本分析。您需要为代码提供符号信息,以使转储文件有价值。网站Memory Dump,软件跟踪,调试,恶意软件,受害者软件和情报分析门户网站对我来说非常有用。我也非常喜欢Mario Hewardt和Daniel Pravat撰写的《Advanced Windows Debugging》一书。