MinGW应用程序的崩溃报告 [英] Crash reporting for MinGW applications

查看:1884
本文介绍了MinGW应用程序的崩溃报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C ++应用程序编译MinGW,我已经收到客户的崩溃投诉。所以,除了大量记录可能崩溃的部分(在发布新版本之前),我一直在寻找一个崩溃记者,将帮助我找到堆栈跟踪和任何其他有用的调试信息,当出现错误。 / p>

是否存在与MinGW应用程序兼容的工具?(似乎编译器和崩溃报告策略之间存在紧密关系



是否有任何Windows工具可以帮助我?应用程序大多在Windows XP计算机上运行。

能够将信息写入文件足以满足我的需要。



我一直在寻找 google-breakpad SetUnhandledExceptionFilter ,但我仍然不知道他们是否会以任何方式有用。其他崩溃报告实用程序(如 crashrpt )是为Visual C ++设计的,因此我想使用MinGW尝试它们不会



编辑:主题上的一些有用的链接




解决方案

实际上,问题不是让崩溃报告工作。这与DbgHelp库函数相当微不足道,最突出的是 MiniDumpWriteDump 。但是,请记住,在旧系统上重新分配DbgHelp库,并遵守您打算调用的函数的版本要求 - Windows的新版本至少包含此库的某些版本。



您使用非MS编译器时遇到的问题(例如,Embarcadero,以前的Borland产品或Watcom也存在这个问题)是调试符号创建没有意义DbgHelp库 - 这是在Windows上进行调试的标准工具。 PDB格式在很大程度上是未公开的(对于一些线索搜索术语:Sven Schreiber PDB )和用于创建的库不是公共的 DbgHelp库 - 后者只能用于读取/解析创建的调试符号。他们是Visual Studio产品的一部分,通常命名为像mspdbXY.dll(其中XY是十进制数字)。



所以,如果你想创建错误报告,我强烈建议,而不是专注于编译器问题,集中在调试器问题。


  1. 使用一个了解您特定调试格式的调试器(在MinGW中使用GDB for DWARF,IIRC )

  2. 使用能够理解多种格式的调试器(IDA也有其他优点)。

  3. WinDbg,以便了解你的bug符号(DWARF)或更一般地 .map 文件(我知道这样的扩展是几年前写的Borland .map 文件)

  4. 学习汇编语言并使用可用工具(WinDbg或更常见的DbgHelp库) (可能是一个太陡峭的学习曲线,除非您已经知道)

作为4的扩展,您也可以让GCC创建< c $ c> .S (汇编)文件,以便在无符号支持的情况下交叉引用源代码和崩溃转储。



鉴于我喜欢GDB在unixoid平台,但WinDbg和Windows上的其他调试器,我不能真正说,是否有支持实际的崩溃转储格式(使用 MiniDumpWriteDump 创建)在Windows上的GDB中,所以我不知道在这种情况下GDB可能会预期什么格式。



BTW:如果你使用Windows XP或更高版本,那么使用 AddVectoredExceptionHandler 而不是 SetUnhandledExceptionFilter 来准备写入崩溃转储。


I have a c++ application compiled with MinGW for which I've been receiving crash complaints from customers. So, besides heavily logging in the parts that might be crashing (before releasing a new version), I've been looking for a crash reporter that will help me find out the stack trace and any other useful debugging information whenever an error arises.

Does any such tool exist that is compatible with MinGW applications? (It seems that there is a close relation between then compiler and the crash reporting strategy, thus the question).

Are there any Windows tools that can help me? The application is being run mostly in Windows XP machines.

Being able to write information to a file is enough for my purposes. Then I can ask my customer to mail me the information.

I've been looking into google-breakpad and SetUnhandledExceptionFilter, but I still don't know if they will be useful in any way. Other crash report utilities, such as crashrpt, are designed for Visual C++, so I guess trying them with MinGW doesn't make a lot of sense.

EDIT: some useful links on the subject

解决方案

Actually the problem is not so much getting the crash reports to work. That is rather trivial with the DbgHelp library functions and most prominently there MiniDumpWriteDump. Remember, however, to redistribute the DbgHelp library on older systems and observe the version requirements for the functions you intend to call - newer versions of Windows come with at least some version of this library.

Your problem with using a non-MS compiler (the problem also exists with the Embarcadero, formerly Borland, products, for example, or Watcom) is that the debug symbols created make no sense to the DbgHelp library - which is the standard facility for debugging on Windows. The PDB format is largely undocumented (for some clues search for the terms: Sven Schreiber PDB) and the libraries used to create them are not "public" in the same sense as the DbgHelp library - the latter can only be used to read/parse the created debug symbols. They are part of the Visual Studio products and usually named something like mspdbXY.dll (where XY are decimal digits).

So, if you want to create bug reports I strongly suggest that instead of concentrating on the "compiler issues", concentrate on the debugger issues. Here are the general directions in which you can go:

  1. Use a debugger that understands your particular debug format (GDB for DWARF in MinGW, IIRC)
  2. Use a debugger that understands multiple formats (IDA comes to mind and has other advantages, too ;))
  3. Write an extension to something like WinDbg in order to make sense of yourdebug symbols (DWARF) or more generically .map files (I'm aware that such extensions were written some years ago for Borland .map files)
  4. Learn assembly language and use the available tools (WinDbg or more generally the DbgHelp library) without symbols (probably a too steep learning curve unless you know it already)

As an extension to 4 you can also let GCC create the .S (assembly) files during compilation in order to cross-reference source code and crash dump when working without symbol support.

Given that I prefer GDB on unixoid platforms, but WinDbg and other debuggers on Windows, I cannot really say whether there is support for the actual crash dump format (created with MiniDumpWriteDump) in GDB on Windows, so I'm not sure what format may be expected by GDB in this case.

BTW: if you use Windows XP or higher and can rely on that fact, use AddVectoredExceptionHandler instead of SetUnhandledExceptionFilter to prepare writing the crash dump.

这篇关于MinGW应用程序的崩溃报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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