如何获取崩溃转储 [英] How do I obtain a crash dump

查看:182
本文介绍了如何获取崩溃转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从一个程序得到一个崩溃转储。我如何得到它?
该计划是用C#。到底是什么故障转储?当它产生的?它在哪里保存?
我怎么看呢?

I need to get a crash dump from a program. How do i get it? The Program is written in C#. What exactly is a crash dump? When is it created? Where is it saved? How do i read it?

推荐答案

既然你说的C#我假设你使用的是Windows平台。

Since you are saying C# I assume you are using the Windows platform.

有一个故障转储,或者只是倾倒,是完整的存储快照,并在特定时间点的过程中其他相关的系统信息。转储可以用来调试程序崩溃,挂起,内存和资源泄漏,可能更多的问题,我还没有在这里列出。

A crashdump, or just dump, is the complete memory snapshot and other related system info of a process at a particular point in time. Dumps can be used to debug program crashes, hangs, memory and resource leaks and probably more problems I have not listed here.

在崩溃的情况下,并挂起你想从一个崩溃转储,以获得将调用堆栈的第一块数据。这表明了崩溃的地步,或在其中运行受阻,再也没有回来所以程序坐着什么都不做。点

In the case of crashes and hangs the first piece of data you want to obtain from a crash dump will be the callstack. This indicates the point of a crash or the point at which an operation blocked and never returned so the program sits and does nothing.

有关资源泄漏的处理的多个存储器转储可以收集在一段时间和检查,以查看存储器正在成长最哪些对象。这可以帮助缩小其中code的部分出现泄漏。要了解更多关于调试的具体问题,我强烈建议这个博客

For resource leaks multiple memory dumps of a process can be collected over a period of time and examined to see which objects in memory are growing the most. This can help narrow down which parts of the code are causing the leak. To learn more about debugging specific issues I highly recommend this blog.

有几种方法来捕获转储文件。

There are a few ways to capture a dump file.


  1. Procdump(<一个href=\"http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx\">http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx)

  2. Visual Studio 2010中(<一个href=\"http://msdn.microsoft.com/en-us/library/vstudio/fk551230(v=vs.100).aspx\">http://msdn.microsoft.com/en-us/library/vstudio/fk551230(v=vs.100).aspx)

  3. 的WinDbg - 不坏,但比其他工具更吓人

使用procdump你可以简单地做:

With procdump you can simply do:

c:\>procdump.exe -ma YourProcessName.exe

此命令的结果将被写入到c YourProcessName.dmp完全内存快照:\\。该-ma开关指定倾倒了完整的内存映像。如果您正在调试一个崩溃或挂起你可以容易脱身,而不-ma开关。请记住,没有完全内存转储,当你去检查的数据结构,你可能不会有有效的数据。如果没有完全内存转储,您将仍然调用堆栈数据是经常崩溃和挂起不够好。我通常对硬盘空间的方的错误是便宜,所以收集完全转储。

The result of this command will be a full memory snapshot of YourProcessName.dmp written to c:\ . The -ma switch specifies dumping a complete memory image. If you are debugging a crash or hang you can likely get away without the -ma switch. Keep in mind without the full memory dump when you go to examine data structures you probably won't have valid data. Without the full memory dump you will still have callstack data which is often good enough for crashes and hangs. I typically error on the side of harddrive space is cheap so collect the full dump.

Procdump也将自动转储的时间间隔,或者当特定的条件被满足。在阅读的链接的文档获取更多信息以上。一个开关,我会建议为 -e

Procdump will also automatically take dumps at time intervals or when a specific condition is met. Read the documentation at the link above for more info. One switch I would recommend is -e.

c:\>procdump.exe -ma -e YourProcessName.exe

而不是写转储立即只会写它时,你的程序崩溃。

Instead of writing the dump immediately it will only write it when your program crashes.

使用Visual Studio 2010中,你可以连接到与调试器的进程,并保存转储文件。 (请记住,当你F5调试你的程序的Visual Studio自动附加)。当你的程序处于破发状态(断点,未处理的异常,崩溃)的调试菜单可以选择保存转储为.. 。然后,你可以保存任何倾倒,你想。

With Visual Studio 2010 you can attach to the process with the debugger and save a dump file. (Keep in mind when you F5 debug your program Visual Studio automatically attaches). When your program is in a "break state" (breakpoint, unhandled exception, crash) the Debug menu will have the option to Save Dump As.... Then you can save that dump any where you would like.

既然你提到C#,你很可能会收集管理转储文件。最简单的方法是使用Visual Studio 2010中很简单,打开你为你创建转储文件的其它文件,并开始调试。

Since you mentioned C# you are very likely collecting managed dump files. The easiest way is to use Visual Studio 2010. Simply, open up the dump file you created as you would any other file and begin debugging.

但是,如果这是不是一种选择,你可以随时使用VS2008或WinDbg中与SOS扩展。我强烈建议Visual Studio 2010中但正如SOS扩展和WinDbg中一般有pretty陡峭的学习曲线。要了解更多关于SOS看看这MSDN文章这里和的here

However, if that is not an option you can always use VS2008 or WinDbg with the SOS extensions. I do highly recommend Visual Studio 2010 though as SOS extensions and WinDbg in general have a pretty steep learning curve. To learn more about SOS check out these MSDN articles here and here.

我建议使用Visual Studio或procdump的另一个原因是,他们将收集您所期望的转储文件。我建议转向明确的任务管理器的创建转储文件工具。其原因是它会收集这是太困难调试32位进程的64位转储。

Another reason I recommend using Visual Studio or procdump is that they will collect the dump file you expect. I recommend steering clear of Task Manager's "Create Dump File Tool". The reason being it will collect 64bit dumps of 32bit processes which are overly difficult to debug.

这篇关于如何获取崩溃转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆