admin管理员组

文章数量:1357682

I wrote a cross-platform application that people use on multiple OSes. To make the build as universal as possible, i chose to compile it with MinGW (or to be more exact: gcc within a Msys2/UCRT environment).

Now this application crashes for one of my users on Windows, but that crash is not reproducible on my machine. So i sent the user a debug version of my application with integrated debug symbols and asked him to send me one of the crash dumps Windows generate, and i got one.

So what i have is

  • an executable built with MinGW in debug mode, with debug symbols inside
  • a Windows crash dump (it's actually a full dump, not just a minidump)

The problem is that while the crash dump is in a format that MS tools understand (WinDbg, Visual Studio, ...), the debug symbols are in a format that GNU tools understand (gdb, ...). So WinDbg opens the dump but cannot translate the stack addresses into source code locations, while gdb won't even open the dump because it's not a coredump.

I know there are already several similar questions, but neither of them have satisfying answers. Here is what i've already tried:

  1. I've tried the vaguely described addr2line method in this question. I printed the stack trace in WinDbg using !analyze -v, i copied the addresses into a text file and i passed that file together with the executable file into addr2line, but it only printed ?? everywhere. Note: I've tried addr2line from Msys2/UCRT and also WSL2 just to be sure.
  2. I've tried dwarfstack. After fixing few compilation errors (because people never have their repositories compilable by default for some reason), i've build the library and the provided example a2l.c and gave it my stack addresses and executable, but it printed absolutely nothing.
  3. I've tried converting my debug executable into MS pdb file using cv2pdb, but it outputed a lot of errors and the pdb was corrupted and couldn't be loaded into Visual Studio.

NOTE: I'll repeat this again, because i see that in the previous questions people didn't get it. The crash doesn't happen on my computer, it only happens to a certain customer, therefore i'm unable to install additional tools (port-mortem debuggers, ...) on that computer. Generating the dump was probably the maximum i could ask from that user.

Please don't tell me i'm the only person on this planet who develops applications for Windows using non-Microsoft build tools and needs to debug them. MinGW has been there for 20+ years, it can't be that there is still no solution to this problem.

本文标签: cHow to debug a crashed program compiled with MinGW from a Windows crash dumpStack Overflow