Search code examples
c++windowswindbgminidump

Resolving symbols in windows Minidump


I am trying to generate a minimal Minidump using MiniDumpWriteDump where I can retroactively attach symbols with a pdb. Currently this works using MiniDumpWithFullMemory but produces a very large dump file.

Producing the dump with MiniDumpNormal produces a small file and gives a stack trace with offsets, but I cannot get Visual Studio or WinDbg to load the symbols. Visual studio just tells me that

Binary was not built with debug information

WinDbg tells me:

ERROR: Symbol file could not be found. Defaulted to export symbols for app.exe.

I have tried several combinations of flags but cannot load symbols without using MiniDumpWithFullMemory. What are the set of flags to generate the smallest possible dump which can resolve symbols for the stack trace?

The executable was built with debug information (/Zi /DEBUG), attaching a debugger to the running process loads the symbols, attaching a debugger to the crashed process (on WER triggering) loads the symbols, and generating the dump with MiniDumpWithFullMemory also loads the symbols, but other dump types do not load the symbols.


Solution

  • The most confusing part of this problem was how all debugging was working correctly except for reduced minidumps. Inspecting the executable revealed the issue:

    symchk app.exe /v

    dumpbin /headers app.exe | grep pdb

    Showed that there was no pdb information in the exe. On inspection of my build system I discovered an extra build step that was embedding a manifest using:

    MT.exe -manifest C:\app.exe.manifest -outputresource:C:\app.exe;1

    Which was causing the pdb information to get stripped.

    Removing this build step keeps the debug information and allows symbols to be loaded from a MiniDumpNormal dump.