24

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

Community
  • 1
  • 1
Jong Bor Lee
  • 3,805
  • 1
  • 24
  • 27
  • What IDE are you using? If it's notepad consider downloading the QT framework and QTCreator for free which uses MinGW on windows by default and has debugging capabilities. – AJG85 Mar 07 '11 at 23:06
  • 1
    Thanks, but I'm looking for a crash reporter, something that will allow me to debug a program that is installed in the customer's computer. – Jong Bor Lee Mar 08 '11 at 01:47

1 Answers1

15

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.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
  • Thanks for your detailed answer. Setting up the crash reporting was trivial indeed using the functions you mention. And GDB doesn't recognize the dump created with MiniDumpWriteDump, which was to be expected. Debug formats definitely seem to be the main issue here, seeing that other people with the same problem haven't found satisfactory answers. Now at least I can get a stack trace (sort of, since not all function names show up - those interested, see the link in my question) and end the application gracefully. – Jong Bor Lee Mar 08 '11 at 18:14