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

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: Finalized, RFC 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
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..1d24f009fa6fcfcec42c363e35ffba4736088b82 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,22 @@ 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 ||
+ crash_context_size != sizeof(ExceptionHandler::CrashContext))
+ return false;
+ const ExceptionHandler::CrashContext* eh_context =
+ static_cast<const ExceptionHandler::CrashContext*>(crash_context);
+ int 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 +847,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 +877,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 +887,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);
Torne 2015/12/16 14:48:35 When does the crash handler set her get called? Af
mnaganov (inactive) 2015/12/16 19:10:12 Before generating the dump, actually. In fact, the
}
}

Powered by Google App Engine
This is Rietveld 408576698