C++ 如何配置 Windows 以从应用程序生成核心转储?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4672572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I configure windows to generate a core dump from an application?
提问by pcent
How can I configure windows to generate a core dump from an application?
如何配置 Windows 以从应用程序生成核心转储?
I'm using Win xp, and the application is build with Visual Studio 2003.
我使用的是 Win xp,应用程序是用 Visual Studio 2003 构建的。
采纳答案by DOK
Microsoft has a free tool called Userdump.exewhich will do this.
Microsoft 有一个名为Userdump.exe的免费工具可以执行此操作。
It's pretty simple to use that tool to create a dump (.dmp) file for a process that shuts down with an exception or to create a dump file for a hanging process
使用该工具为异常关闭的进程创建转储 (.dmp) 文件或为挂起的进程创建转储文件非常简单
回答by Roger Perkins
Just to throw in some other suggestions:
只是提出一些其他建议:
- ProcDumpthat is part of the MS SysInternals suite (it captures crashes but also does a load more, can take dumps if CPU usage spikes for an amount of time, etc)
- You can put code into your exe using MiniDumpWriteDump to save out dumps youself (which I've done in a few tools). You have control over the name and location (i.e. network path). There's some sample code here
回答by splintor
You can open Task Manager (by right clicking the task bar), find your process in the processes tab, right-click it and select Create Dump File.
您可以打开任务管理器(通过右键单击任务栏),在进程选项卡中找到您的进程,右键单击它并选择Create Dump File。
回答by Mark Wilkins
You can use adplusto produce a crash dump for a running application. The command may look something like this:
您可以使用adplus为正在运行的应用程序生成故障转储。该命令可能如下所示:
C:\Program Files\Debugging Tools for Windows\adplus.vbs -hang -do -o c:\ -quiet -pn theprocess.exe
You can also attach to a process with windbg and run this command:
您还可以使用 windbg 附加到进程并运行以下命令:
.dump /ma c:\somepath\filename.dmp
回答by David Heffernan
I refer you to the follows MS KB articleon the subject. You would typically debug the dump file using one of the Windows debugging tools, e.g. WinDbg. There are many articles on the web describing how to do this.
我建议您参阅以下有关该主题的MS KB 文章。您通常会使用一种 Windows 调试工具(例如 WinDbg)来调试转储文件。网上有很多文章描述了如何做到这一点。