后台服务程序生成dmp文件只有0kb,是什么情况

C++语言 码拜 8年前 (2016-09-21) 4823次浏览
项目的后台服务程序,有设置SetUnhandledExceptionFilter,在回调函数中有崩溃时生成dmp文件的机制,但有时崩溃时生成的dmp文件只有0kb,啥内容也没有,问一下在什么情况下会生成0kb的dmp文件?
解决方案

40

Crash Dump Analysis
Published: December 2005
Updated: August 2009
Not all bugs can be found prior to release, which means not all bugs that throw exceptions can be found before release. Fortunately, Microsoft has included in the Platform SDK a function to help developers collect information on exceptions that are discovered by users. The MiniDumpWriteDump function writes the necessary crash dump information to a file without saving the whole process space. This crash dump information file is called a minidump.
This technical article covers the following topics:
Writing a Minidump
Thread safety
Writing a Minidump with Code
Using Dumpchk.exe
Analyzing a Minidump
Summary
Writing a Minidump
The basic options for writing a minidump are as follows:
Do nothing. Windows automatically generates a minidump whenever a program throws an unhandled exception. Automatic generation of a minidump is available on Windows XP, Windows Vista, and Windows 7. If the user allows it, the minidump will be sent to Microsoft, and not to the developer, through Windows Error Reporting (WER). Developers can contact the Microsoft Windows Gaming & Graphics developer relations group to arrange for access to the WER service.
Use of WER requires:
Developers to sign their applications using Authenticode
Developers to obtain a VeriSign ID to access the WinQual service
Applications have valid VERSIONINFO resource in every executable and DLL
If you implement a custom routine for unhandled exceptions, you are strongly urged to use the ReportFault function in the exception handler to also send an automated minidump to WER. The ReportFault function handles all of the issues of connecting to and sending the minidump to WER. Not sending minidumps to WER violates the requirements of Games for Windows.
For more information on how WER works, see How Windows Error Reporting Works. For an explanation of registration details, see Introducing Windows Error Reporting on MSDN”s ISV Zone.
Use a product from the Microsoft Visual Studio Team System. On the Debug menu, click Save Dump As to save a copy of a dump. Use of a locally saved dump is only an option for in-house testing and debugging.
Add code to your project. Add the MiniDumpWriteDump function and the appropriate exception handling code to save and send a minidump directly to the developer. This article demonstrates how to implement this option. However, note that MiniDumpWriteDump does not currently work with managed code and is only available on Windows XP, Windows Vista, Windows 7.
Thread safety
MiniDumpWriteDump is part of the DBGHELP library. This library is not thread-safe, so any program that uses MiniDumpWriteDump should synchronize all threads before attempting to call MiniDumpWriteDump.
Writing a Minidump with Code
The actual implementation is straightforward. The following is a simple example of how to use MiniDumpWriteDump.

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明后台服务程序生成dmp文件只有0kb,是什么情况
喜欢 (0)
[1034331897@qq.com]
分享 (0)