From fff574b23338309ce493edd63a2f8bd854df1c94 Mon Sep 17 00:00:00 2001
From: "morrita@chromium.org"
 <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 2 Dec 2010 00:43:33 +0000
Subject: [PATCH] TestShell windows: add --crash-dumps-fulldump option to allow
 the dump including the heap memory.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/5262011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67925 0039d316-1c4b-4281-b951-d872f2087c98
---
 webkit/tools/test_shell/test_shell_switches.cc |  2 ++
 webkit/tools/test_shell/test_shell_switches.h  |  1 +
 webkit/tools/test_shell/test_shell_win.cc      | 14 +++++++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/webkit/tools/test_shell/test_shell_switches.cc b/webkit/tools/test_shell/test_shell_switches.cc
index 29d8328bdcbfb..b935e15824e3c 100644
--- a/webkit/tools/test_shell/test_shell_switches.cc
+++ b/webkit/tools/test_shell/test_shell_switches.cc
@@ -13,6 +13,8 @@ const char kNoErrorDialogs[]                = "noerrdialogs";
 // respectively, and interferes with interactive use of the UI.
 const char kLayoutTests[] = "layout-tests";
 const char kCrashDumps[] = "crash-dumps";  // Enable crash dumps
+// Dumps the full-heap instead of only stack. Used with kCrashDumps.
+const char kCrashDumpsFulldump[] = "crash-dumps-fulldump";
 
 // Causes the test_shell to run with a generic theme (part of layout_tests).
 const char kGenericTheme[] = "generic-theme";
diff --git a/webkit/tools/test_shell/test_shell_switches.h b/webkit/tools/test_shell/test_shell_switches.h
index cb5d722720627..f69910e719360 100644
--- a/webkit/tools/test_shell/test_shell_switches.h
+++ b/webkit/tools/test_shell/test_shell_switches.h
@@ -10,6 +10,7 @@
 namespace test_shell {
 
 extern const char kCrashDumps[];
+extern const char kCrashDumpsFulldump[];
 extern const char kDumpPixels[];
 extern const char kLayoutTests[];
 extern const char kGenericTheme[];
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 509027161d582..aba23fc6b6eb8 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -151,6 +151,11 @@ HINSTANCE TestShell::instance_handle_;
 /////////////////////////////////////////////////////////////////////////////
 // static methods on TestShell
 
+const MINIDUMP_TYPE kFullDumpType = static_cast<MINIDUMP_TYPE>(
+    MiniDumpWithFullMemory |  // Full memory from process.
+    MiniDumpWithProcessThreadData |  // Get PEB and TEB.
+    MiniDumpWithHandleData);  // Get all handle information.
+
 void TestShell::InitializeTestShell(bool layout_test_mode,
                                     bool allow_external_pages) {
   // Start COM stuff.
@@ -180,7 +185,14 @@ void TestShell::InitializeTestShell(bool layout_test_mode,
   if (parsed_command_line.HasSwitch(test_shell::kCrashDumps)) {
     std::wstring dir(
         parsed_command_line.GetSwitchValueNative(test_shell::kCrashDumps));
-    new google_breakpad::ExceptionHandler(dir, 0, &MinidumpCallback, 0, true);
+    if (parsed_command_line.HasSwitch(test_shell::kCrashDumpsFulldump)) {
+        new google_breakpad::ExceptionHandler(
+            dir, 0, &MinidumpCallback, 0, true,
+            kFullDumpType, 0, 0);
+    } else {
+        new google_breakpad::ExceptionHandler(
+            dir, 0, &MinidumpCallback, 0, true);
+    }
   }
 }
 
-- 
GitLab