崩溃时如何为我的进程创建小型转储?
我无法通过更改系统设置从我的进程中创建小型转储.所以我的问题是:
I am not able to create minidump form my process by changing system setting. So my Question is :
当用户进程崩溃时,系统会为它创建一个小型转储
Will the system create a minidump for a user process when it crashes
如果是,我需要配置哪些设置
If yes, which setting do I need to configure
或者我必须以编程方式创建小型转储.
Or do I have to create minidump programmatically.
小型转储在调查崩溃时的效果如何
How effective are minidumps while investigating a crash
我使用的是 Windows XP、C++、VC6
I'm using Windows XP, C++, VC6
推荐答案
您需要以编程方式创建小型转储(有一个例外,请参阅下一个链接).CodeProject 有一篇不错的关于 MiniDumps 的文章.基本上,您想使用 dbghelp.dll
,并使用函数 MiniDumpWriteDump()
(请参阅 MiniDumpWriteDump 上的 MSDN).
You need to programatically create a minidump (with one exception, see next link). CodeProject has a nice article on MiniDumps. Basically, you want to use dbghelp.dll
, and use the function MiniDumpWriteDump()
(see MSDN on MiniDumpWriteDump).
此类转储的有效性在很大程度上取决于应用程序.有时,对于优化的二进制文件,它们实际上是无用的.此外,如果没有经验,堆/堆栈损坏错误会导致您误入歧途.
How effective such dumps are depends very much on the application. Sometimes, for optimized binaries, they are practically useless. Also, without experience, heap/stack corruption bugs will lead you astray.
但是,如果优化器对您不是太苛刻,那么转储 do 会帮助您解决一大类错误,即所有具有堆栈跟踪 + 本地值的错误使用的变量很有用,即许多纯虚函数调用的东西(即错误的销毁顺序)、访问冲突(未初始化的访问或缺少 NULL 检查)等.
However, if the optimizer was not too hard on you, there is a large class of errors where the dumps do help, namely all the bugs where having a stack-trace + values of the locally used variables is useful, i.e. many pure-virtual-function call things (i.e. wrong destruction order), access violations (uninitialized accessed or missing NULL checks), etc.
顺便说一句,如果您的维护政策以某种方式允许,请将您的应用程序从 VC6 移植到可接受的版本,例如 VC8 或 9.您会帮自己一个大忙.
BTW, if your maintenance policy somehow allows it, port your application from VC6 to something acceptable, like VC8 or 9. You'll do yourself a big favor.
相关文章