summaryrefslogtreecommitdiffstats
path: root/chrome/app/breakpad_win.cc
diff options
context:
space:
mode:
authorsiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 21:33:28 +0000
committersiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 21:33:28 +0000
commit9e95fd3e871e0bb43c08329e113965ea6d140837 (patch)
treeacdc4eab0476fc20a0b633b63a539601928dd1ce /chrome/app/breakpad_win.cc
parent7d0d57e4f016f17a951102ab8fc04273b9f15a7c (diff)
downloadchromium_src-9e95fd3e871e0bb43c08329e113965ea6d140837.zip
chromium_src-9e95fd3e871e0bb43c08329e113965ea6d140837.tar.gz
chromium_src-9e95fd3e871e0bb43c08329e113965ea6d140837.tar.bz2
Tweak minidump flags to include a little more detail.
In release channel this adds PEB/TEB and the unloaded module list to crash dumps. In dev/beta channel builds this additionally adds stack-referenced memory to crash dumps. For full memory dumps, this adds capture of the PEB/TEB, unloaded module list and all handle information. These minidump flags have been verified safe against the DbgHelp.dll version shipping with XP SP2 and later. Move some code from platform_util to install_util to allow reusing it in the chrome exe project. Add a test for the additional install_util code. BUG=32441 TEST=Unittests in this change. Review URL: http://codereview.chromium.org/659001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_win.cc')
-rw-r--r--chrome/app/breakpad_win.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index 9668038..a0ed497 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -25,6 +25,24 @@
namespace {
+// Minidump with stacks, PEB, TEB, and unloaded module list.
+const MINIDUMP_TYPE kSmallDumpType = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithProcessThreadData | // Get PEB and TEB.
+ MiniDumpWithUnloadedModules); // Get unloaded modules when available.
+
+// Minidump with all of the above, plus memory referenced from stack.
+const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithProcessThreadData | // Get PEB and TEB.
+ MiniDumpWithUnloadedModules | // Get unloaded modules when available.
+ MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack.
+
+// Large dump with all process memory.
+const MINIDUMP_TYPE kFullDumpType = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithFullMemory | // Full memory from process.
+ MiniDumpWithProcessThreadData | // Get PEB and TEB.
+ MiniDumpWithHandleData | // Get all handle information.
+ MiniDumpWithUnloadedModules); // Get unloaded modules when available.
+
const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
@@ -326,6 +344,8 @@ static DWORD __stdcall InitCrashReporterThread(void* param) {
const CommandLine& command = *CommandLine::ForCurrentProcess();
bool use_crash_service = command.HasSwitch(switches::kNoErrorDialogs) ||
GetEnvironmentVariable(L"CHROME_HEADLESS", NULL, 0);
+ bool is_per_user_install =
+ InstallUtil::IsPerUserInstall(info->dll_path.c_str());
std::wstring pipe_name;
if (use_crash_service) {
@@ -346,7 +366,7 @@ static DWORD __stdcall InitCrashReporterThread(void* param) {
// System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18"
// Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
std::wstring user_sid;
- if (InstallUtil::IsPerUserInstall(info->dll_path.c_str())) {
+ if (is_per_user_install) {
if (!win_util::GetUserSidString(&user_sid)) {
if (callback)
InitDefaultCrashCallback();
@@ -364,8 +384,17 @@ static DWORD __stdcall InitCrashReporterThread(void* param) {
wchar_t temp_dir[MAX_PATH] = {0};
::GetTempPathW(MAX_PATH, temp_dir);
- bool full_dump = command.HasSwitch(switches::kFullMemoryCrashReport);
- MINIDUMP_TYPE dump_type = full_dump ? MiniDumpWithFullMemory : MiniDumpNormal;
+ MINIDUMP_TYPE dump_type = kSmallDumpType;
+ // Capture full memory if explicitly instructed to.
+ if (command.HasSwitch(switches::kFullMemoryCrashReport)) {
+ dump_type = kFullDumpType;
+ } else {
+ // Capture more detail in crash dumps for beta and dev channel builds.
+ string16 channel_string;
+ GoogleUpdateSettings::GetChromeChannel(&channel_string);
+ if (channel_string == L"dev" || channel_string == L"beta")
+ dump_type = kLargerDumpType;
+ }
g_breakpad = new google_breakpad::ExceptionHandler(temp_dir, &FilterCallback,
callback, NULL,