Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4064)

Unified Diff: chrome/app/breakpad_linux.cc

Issue 10908115: Always drop a tombstone (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« build/common.gypi ('K') | « build/common.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/breakpad_linux.cc
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 705b9365cd10fea0fc16e545b8f5f3e127276f33..8b6bd80fec7dec3424b9912cc0df37073fbe43c7 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -376,6 +376,37 @@ size_t WriteLog(const char* buf, size_t nbytes) {
#endif
}
+#if defined(OS_ANDROID)
+// Android's native crash handler outputs a diagnostic tombstone to the device
+// log. By returning false from the HandlerCallbacks, breakpad will reinstall
+// the previous (i.e. native) signal handlers before returning from its own
+// handler. A Chrome build fingerprint is written to the log, so that the
+// specific build of Chrome can be determined directly from it.
+bool FinalizeCrashDoneAndroid() {
+ base::android::BuildInfo* android_build_info =
+ base::android::BuildInfo::GetInstance();
+
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ "### ### ### ### ### ### ### ### ### ### ### ### ###");
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ "Chrome build fingerprint:");
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ android_build_info->package_version_name());
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ android_build_info->package_version_code());
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ CHROME_SYMBOLS_LOCATION);
+ __android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
+ "### ### ### ### ### ### ### ### ### ### ### ### ###");
+ return false;
+}
+
+bool CrashDoneNonBrowserAndroid(const MinidumpDescriptor& minidump,
+ void* context,
+ bool succeeded) {
+ return FinalizeCrashDoneAndroid();
+}
+#endif
bool CrashDone(const MinidumpDescriptor& minidump,
const bool upload,
@@ -411,7 +442,11 @@ bool CrashDone(const MinidumpDescriptor& minidump,
info.oom_size = base::g_oom_size;
info.pid = 0;
HandleCrashDump(info);
+#if defined(OS_ANDROID)
+ return FinalizeCrashDoneAndroid();
+#else
return true;
+#endif
}
// Wrapper function, do not add more code here.
@@ -578,7 +613,14 @@ bool NonBrowserCrashHandler(const void* crash_context,
WriteLog(errmsg, sizeof(errmsg)-1);
}
+#if defined(OS_ANDROID)
+ // When false is returned, breakpad will continue to its minidump generator
+ // and then to the HandlerCallback, which, in this case, is
+ // CrashDoneNonBrowserAndroid.
Lei Zhang 2012/09/06 19:13:36 nit: CrashDoneNonBrowserAndroid()
cjhopman 2012/09/07 18:09:20 Done.
+ return false;
+#else
return true;
+#endif
}
void EnableNonBrowserCrashDumping() {
@@ -586,6 +628,15 @@ void EnableNonBrowserCrashDumping() {
g_is_crash_reporter_enabled = true;
// We deliberately leak this object.
DCHECK(!g_breakpad);
+#if defined(OS_ANDROID)
+ g_breakpad = new ExceptionHandler(
+ MinidumpDescriptor("/tmp"), // Unused but needed or Breakpad will assert.
+ NULL,
+ CrashDoneNonBrowserAndroid,
Lei Zhang 2012/09/06 19:13:36 Would it be easier to avoid duplicating the code b
cjhopman 2012/09/07 18:09:20 Done.
+ reinterpret_cast<void*>(fd), // Param passed to the crash handler.
+ true,
+ -1);
+#else
g_breakpad = new ExceptionHandler(
MinidumpDescriptor("/tmp"), // Unused but needed or Breakpad will assert.
NULL,
@@ -593,6 +644,7 @@ void EnableNonBrowserCrashDumping() {
reinterpret_cast<void*>(fd), // Param passed to the crash handler.
true,
-1);
+#endif
g_breakpad->set_crash_handler(NonBrowserCrashHandler);
}
« build/common.gypi ('K') | « build/common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698