summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 00:07:22 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 00:07:22 +0000
commitd007cf7cf5e05b790740b3d2764a018ade11a65f (patch)
tree3c5f97881519c974ce621ea24efec4cf74d70f84 /components
parent9e74e6862b800fa84330e739c86411b4869d27af (diff)
downloadchromium_src-d007cf7cf5e05b790740b3d2764a018ade11a65f.zip
chromium_src-d007cf7cf5e05b790740b3d2764a018ade11a65f.tar.gz
chromium_src-d007cf7cf5e05b790740b3d2764a018ade11a65f.tar.bz2
Linux: Initialize CrashKeys in Breakpad before setting the GUID for non-browser processes.
BUG=354264 TEST=Manual, see bug. Review URL: https://codereview.chromium.org/206523004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/breakpad/app/breakpad_linux.cc38
1 files changed, 24 insertions, 14 deletions
diff --git a/components/breakpad/app/breakpad_linux.cc b/components/breakpad/app/breakpad_linux.cc
index b4972cc..9dfe0c3 100644
--- a/components/breakpad/app/breakpad_linux.cc
+++ b/components/breakpad/app/breakpad_linux.cc
@@ -513,7 +513,7 @@ void CrashReporterWriter::AddFileContents(const char* filename_msg,
AddItem(file_data, file_size);
Flush();
}
-#endif
+#endif // defined(OS_CHROMEOS)
void DumpProcess() {
if (g_breakpad)
@@ -864,6 +864,26 @@ void ClearCrashKey(const base::StringPiece& key) {
g_crash_keys->RemoveKey(key.data());
}
+// GetBreakpadClient() cannot call any Set methods until after InitCrashKeys().
+void InitCrashKeys() {
+ g_crash_keys = new CrashKeyStorage;
+ GetBreakpadClient()->RegisterCrashKeys();
+ base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValue, &ClearCrashKey);
+}
+
+// Miscellaneous initialization functions to call after Breakpad has been
+// enabled.
+void PostEnableBreakpadInitialization() {
+ SetProcessStartTime();
+ g_pid = getpid();
+
+ base::debug::SetDumpWithoutCrashingFunction(&DumpProcess);
+#if defined(ADDRESS_SANITIZER)
+ // Register the callback for AddressSanitizer error reporting.
+ __asan_set_error_report_callback(AsanLinuxBreakpadCallback);
+#endif
+}
+
} // namespace
void LoadDataFromFD(google_breakpad::PageAllocator& allocator,
@@ -1484,6 +1504,7 @@ void InitCrashReporter(const std::string& process_type) {
return;
}
+ InitCrashKeys();
EnableCrashDumping(GetBreakpadClient()->IsRunningUnattended());
} else if (GetBreakpadClient()->EnableBreakpadForProcess(process_type)) {
#if defined(OS_ANDROID)
@@ -1498,25 +1519,14 @@ void InitCrashReporter(const std::string& process_type) {
// simplicity.
if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter))
return;
+ InitCrashKeys();
SetClientIdFromCommandLine(parsed_command_line);
EnableNonBrowserCrashDumping();
VLOG(1) << "Non Browser crash dumping enabled for: " << process_type;
#endif // #if defined(OS_ANDROID)
}
- SetProcessStartTime();
- g_pid = getpid();
-
- base::debug::SetDumpWithoutCrashingFunction(&DumpProcess);
-#if defined(ADDRESS_SANITIZER)
- // Register the callback for AddressSanitizer error reporting.
- __asan_set_error_report_callback(AsanLinuxBreakpadCallback);
-#endif
-
- g_crash_keys = new CrashKeyStorage;
- GetBreakpadClient()->RegisterCrashKeys();
- base::debug::SetCrashKeyReportingFunctions(
- &SetCrashKeyValue, &ClearCrashKey);
+ PostEnableBreakpadInitialization();
}
#if defined(OS_ANDROID)