当我的进程崩溃时,如何为它创建小型转储?
我无法通过更改系统设置从我的进程中创建小型转储。所以我的问题是 :
当用户进程崩溃时系统会为其创建一个小型转储
如果是,我需要配置哪个设置
还是我必须创建小型转储 。
调查崩溃时小型转储的有效性如何
我使用的是 Windows XP、C++、VC6
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
I'm using Windows XP, C++, VC6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您需要以编程方式创建小型转储(有一个例外,请参阅下一个链接)。 CodeProject 有一篇很好的关于 MiniDumps 的文章。基本上,您想要使用
dbghelp.dll
,并使用函数MiniDumpWriteDump()
(请参阅MiniDumpWriteDump 上的 MSDN)。此类转储的有效性很大程度上取决于应用程序。有时,对于优化的二进制文件来说,它们实际上毫无用处。此外,如果没有经验,堆/堆栈损坏错误会让您误入歧途。
但是,如果优化器对您来说不是太难,那么转储会帮助解决一大类错误,即具有堆栈跟踪+本地使用变量的值的所有错误有用,即许多纯虚拟函数调用事物(即错误的销毁顺序)、访问冲突(未初始化的访问或缺少 NULL 检查)等。
顺便说一句,如果您的维护策略以某种方式允许它,请将您的应用程序从 VC6 移植到可接受的东西,比如 VC8 或 9。你会帮自己一个大忙。
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 functionMiniDumpWriteDump()
(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.
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.
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.
我在 debugInfo.com 上发现了一篇优秀的文章,值得一读:
Wayback Machine 上的存档版本。
I found an excellent article on debugInfo.com This is worth to read:
effective minidumps, now staled, so see archived version on Wayback Machine.
我意识到这是一个老问题,但就系统设置(OP 的第一个点)而言,您可以启用设置以使用 Windows 错误报告的内置自动崩溃转储生成。此处记录了这一点:https://learn。 microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps。由于这需要提升,因此最好手动设置(假设您是管理员)或在应用程序安装时设置。如果您的应用程序不需要提升,我不建议在运行时设置它。
本质上,您可以在
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\
下创建一个新项,并自定义其中的选项。这样做的好处是,故障转储是自动生成的,您可以控制它们的存储位置、类型和包含的信息,以及保留多少转储。这可能是在 Windows 上生成和管理用户模式故障转储的最简单方法。
I realise this is an old question, but in terms of system settings (first dot point of the OP), you can enable a setting to use Windows Error Reporting's built-in auto-crash dump generation. This is documented here: https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps. As this requires elevation, this is best set either manually (provided you're an admin) or at your application's install time. I don't recommend setting it at runtime if your app otherwise does not require elevation.
Essentially, you create create a new key under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<app_name.exe>
and customise the options there. The nice thing about this is that the crash dumps are automatically generated, and you can can control where they're stored, the type and what info is included, and how many dumps are retained.This is probably the easiest method of generating and managing user mode crash dumps on Windows.
我们在 Firefox 中使用 Google Breakpad,尽管这至少需要 Visual C++ 2003。附带的好处是它还支持 OS X 和 Linux。
We use Google Breakpad in Firefox, although that requires at least Visual C++ 2003. The nice side benefit is that it also supports OS X and Linux.
我最终在 Windows 上使用了 CrashRpt(需要我将整个代码库和工具链从 MinGW 移动到本机 Microsoft C/C++ 编译器),并在 Linux 上使用 google-breakpad。
I ended up using CrashRpt on Windows (required me to move the whole codebase and toolchain from MinGW to native Microsoft C/C++ compiler), and google-breakpad on Linux.
如果您还有闲钱,AQtrace 可能值得一看。这具有在远程最终用户计算机上运行时调试器内部发生崩溃的许多优点。
If you have a few bucks to spare AQtrace may be worth a look at. This has many of the advantages of the crash occurring inside the debugger, while running on a remote end user machine.