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

Unified Diff: components/crash/content/app/breakpad_linux.cc

Issue 1525023003: Distinguish in the browser between renderer crashes and kills (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sort out the case of wrong context size Created 5 years 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
« no previous file with comments | « components/crash.gypi ('k') | components/crash/content/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crash/content/app/breakpad_linux.cc
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc
index 62888ad9ff5fa9f6d88feb8e640bb66d886070a3..629aaf9fbe168a0bef4ad0f5c845b3aa129f3ae1 100644
--- a/components/crash/content/app/breakpad_linux.cc
+++ b/components/crash/content/app/breakpad_linux.cc
@@ -96,8 +96,10 @@ ExceptionHandler* g_breakpad = nullptr;
const char* g_asan_report_str = nullptr;
#endif
#if defined(OS_ANDROID)
+const char kWebViewProcessType[] = "webview";
char* g_process_type = nullptr;
ExceptionHandler* g_microdump = nullptr;
+int g_signal_code_pipe_fd = -1;
class MicrodumpInfo {
public:
@@ -737,7 +739,24 @@ bool MicrodumpCrashDone(const MinidumpDescriptor& minidump,
const bool is_browser_process = (context != nullptr);
return FinalizeCrashDoneAndroid(is_browser_process);
- }
+}
+
+bool WriteSignalCodeToPipe(const void* crash_context,
+ size_t crash_context_size,
+ void* context) {
+ if (g_signal_code_pipe_fd == -1)
+ return false;
+ int signo = 66; // The code that doesn't correspond to any real signal.
Torne 2016/01/04 11:28:51 Why 66 in particular? maximum int or something see
mnaganov (inactive) 2016/01/04 17:17:20 Done.
+ if (crash_context_size == sizeof(ExceptionHandler::CrashContext)) {
+ const ExceptionHandler::CrashContext* eh_context =
+ static_cast<const ExceptionHandler::CrashContext*>(crash_context);
+ signo = eh_context->siginfo.si_signo;
+ }
+ sys_write(g_signal_code_pipe_fd, &signo, sizeof(signo));
+ IGNORE_RET(sys_close(g_signal_code_pipe_fd));
+ g_signal_code_pipe_fd = -1;
+ return false;
+}
bool CrashDoneInProcessNoUpload(
const google_breakpad::MinidumpDescriptor& descriptor,
@@ -830,7 +849,8 @@ void MicrodumpInfo::Initialize(const std::string& process_type,
const char* android_build_fp) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!g_microdump);
- bool is_browser_process = process_type.empty() || process_type == "webview";
+ bool is_browser_process =
+ process_type.empty() || process_type == kWebViewProcessType;
MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole);
@@ -859,7 +879,7 @@ void MicrodumpInfo::Initialize(const std::string& process_type,
true, // Install handlers.
-1); // Server file descriptor. -1 for in-process.
- if (process_type == "webview") {
+ if (process_type == kWebViewProcessType) {
// We do not use |DumpProcess()| for handling programatically
// generated dumps for WebView because we only know the file
// descriptor to which we are dumping at the time of the call to
@@ -869,6 +889,11 @@ void MicrodumpInfo::Initialize(const std::string& process_type,
// time.
base::debug::SetDumpWithoutCrashingFunction(
&GenerateMinidumpOnDemandForAndroid);
+ } else if (!process_type.empty()) {
+ g_signal_code_pipe_fd =
+ GetCrashReporterClient()->GetAndroidMinidumpDescriptor();
+ if (g_signal_code_pipe_fd != -1)
+ g_microdump->set_crash_handler(WriteSignalCodeToPipe);
}
}
« no previous file with comments | « components/crash.gypi ('k') | components/crash/content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698