Bug #72284 please use better options to MiniDumpWriteDump for informative minidump
Submitted: 9 Apr 2014 7:37
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Windows Severity:S4 (Feature request)
Version:5.6, 5.7, 8.0 OS:Windows
Assigned to: CPU Architecture:Any

[9 Apr 2014 7:37] Shane Bester
Description:
On Windows the --core-file option creates a minidump by calling MiniDumpWriteDump with the MiniDumpNormal option.  This is not enough information to even get the query from the minidump.

Relevant code:

if(GetModuleFileName(NULL, path, sizeof(path)))
  {
    _splitpath(path, NULL, NULL,dump_fname,NULL);
    strncat(dump_fname, ".dmp", sizeof(dump_fname));
  }

  hFile= CreateFile(dump_fname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
    FILE_ATTRIBUTE_NORMAL, 0);
  if(hFile)
  {
    /* Create minidump */
    if(MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
      hFile, MiniDumpNormal, &info, 0, 0))
    {
      my_safe_printf_stderr("Minidump written to %s\n",
                            _fullpath(path, dump_fname, sizeof(path)) ?
                            path : dump_fname);
    }

How to repeat:
Examine variables in the minidump file. Note that the values aren't available and show up as invalid references, etc.  

Try get a query that crashed, it is not in the minidump.

Suggested fix:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680519(v=vs.85).aspx
I don't know which option is perfect here.

Note: we do not want innodb buffer pool included in the minidump.
But I want similar information as provided by linux corefile.

Lastly, please do not hardcode the name as "<module name>.dmp".  
Use the process id as part of the name.  Otherwise these files get overridden.
[8 Apr 2015 8:27] MySQL Verification Team
So if you want to debug a crash on windows,  you need a full dump instead of minidump.  Edit registry like this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\mysqld.exe]
"DumpFolder"="c:\\mysql_crashes"
"DumpCount"=dword:00000010
"DumpType"=dword:00000002

That would allow some full dumps of mysqld.exe to be saved in the path given.
[8 Apr 2015 8:27] MySQL Verification Team
"Collecting User-Mode Dumps"
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx