bug 620974 - add memory mapping info to Windows minidumps when we have a new enough dbghelp.dll. r+a=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Wed, 12 Jan 2011 14:13:52 -0500
changeset 60513 f932163ae6a07439ad8f0b2f3574222d67dbea75
parent 60512 f725e0b7787b167aa428be98cabc8e4c9b465e3f
child 60514 247da71f616e0ec93d6454f97f48f1d64113665e
push id18030
push usertmielczarek@mozilla.com
push dateFri, 14 Jan 2011 15:39:54 +0000
treeherdermozilla-central@bd51bbe88214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs620974
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 620974 - add memory mapping info to Windows minidumps when we have a new enough dbghelp.dll. r+a=bsmedberg
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -712,28 +712,56 @@ nsresult SetExceptionHandler(nsILocalFil
                                     pref_cpu_types,
                                     &attr_ocount) != 0 ||
       attr_ocount != attr_count) {
     posix_spawnattr_destroy(&spawnattr);
     return NS_ERROR_FAILURE;
   }
 #endif
 
+#ifdef XP_WIN
+  // Try to determine what version of dbghelp.dll we're using.
+  // MinidumpWithFullMemoryInfo is only available in 6.1.x or newer.
+  MINIDUMP_TYPE minidump_type = MiniDumpNormal;
+  DWORD version_size = GetFileVersionInfoSizeW(L"dbghelp.dll", NULL);
+  if (version_size > 0) {
+    std::vector<BYTE> buffer(version_size);
+    if (GetFileVersionInfoW(L"dbghelp.dll",
+                           0,
+                           version_size,
+                           &buffer[0])) {
+      UINT len;
+      VS_FIXEDFILEINFO* file_info;
+      VerQueryValue(&buffer[0], L"\\", (void**)&file_info, &len);
+      WORD major = HIWORD(file_info->dwFileVersionMS),
+           minor = LOWORD(file_info->dwFileVersionMS),
+           revision = HIWORD(file_info->dwFileVersionLS);
+      if (major > 6 || (major == 6 && minor > 1) ||
+          (major == 6 && minor == 1 && revision >= 7600)) {
+        minidump_type = MiniDumpWithFullMemoryInfo;
+      }
+    }
+  }
+#endif
+
   // now set the exception handler
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(tempPath.get(),
 #ifdef XP_WIN
                      FPEFilter,
 #else
                      nsnull,
 #endif
                      MinidumpCallback,
                      nsnull,
 #if defined(XP_WIN32)
-                     google_breakpad::ExceptionHandler::HANDLER_ALL);
+                     google_breakpad::ExceptionHandler::HANDLER_ALL,
+                     minidump_type,
+                     NULL,
+                     NULL);
 #else
                      true
 #if defined(XP_MACOSX)
                        , NULL
 #endif
                       );
 #endif // XP_WIN32